lib/mpi: added missing NULL check
authorDmitry Kasatkin <dmitry.kasatkin@intel.com>
Thu, 26 Jan 2012 17:13:18 +0000 (19:13 +0200)
committerJames Morris <jmorris@namei.org>
Wed, 1 Feb 2012 13:23:39 +0000 (00:23 +1100)
Added missing NULL check after mpi_alloc_limb_space().

Signed-off-by: Dmitry Kasatkin <dmitry.kasatkin@intel.com>
Reviewed-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: James Morris <jmorris@namei.org>
lib/mpi/mpi-div.c

index 8a45717bd001e0ea36855de0ba2312e07983d92b..f68cbbb4d4a4ec74246be1559e2beaa0c1ce5284 100644 (file)
@@ -210,6 +210,8 @@ int mpi_tdiv_qr(MPI quot, MPI rem, MPI num, MPI den)
                 * numerator would be gradually overwritten by the quotient limbs.  */
                if (qp == np) { /* Copy NP object to temporary space.  */
                        np = marker[markidx++] = mpi_alloc_limb_space(nsize);
+                       if (!np)
+                               goto nomem;
                        MPN_COPY(np, qp, nsize);
                }
        } else                  /* Put quotient at top of remainder. */