GH1555: Don't bump size on realloc failure
authorRich Salz <rsalz@openssl.org>
Fri, 9 Sep 2016 14:52:59 +0000 (10:52 -0400)
committerRich Salz <rsalz@openssl.org>
Wed, 21 Sep 2016 14:40:27 +0000 (10:40 -0400)
Reviewed-by: Richard Levitte <levitte@openssl.org>
crypto/lhash/lhash.c

index 19c6d2c..adde832 100644 (file)
@@ -213,8 +213,8 @@ static int expand(OPENSSL_LHASH *lh)
         j = (int)lh->num_alloc_nodes * 2;
         n = OPENSSL_realloc(lh->b, (int)(sizeof(OPENSSL_LH_NODE *) * j));
         if (n == NULL) {
-            /* fputs("realloc error in lhash",stderr); */
             lh->error++;
+            lh->num_nodes--;
             lh->p = 0;
             return 0;
         }