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:42:10 +0000 (10:42 -0400)
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 6fcace45bda108ad4d3f95261494dd479720d92c)

crypto/lhash/lhash.c

index 53c5c138bb67add321c2c3f3e6827f730004f02b..f20353aea33f4fa8b42d800f9a9b0fac5b95b413 100644 (file)
@@ -335,8 +335,8 @@ static void expand(_LHASH *lh)
         n = (LHASH_NODE **)OPENSSL_realloc(lh->b,
                                            (int)(sizeof(LHASH_NODE *) * j));
         if (n == NULL) {
-/*                      fputs("realloc error in lhash",stderr); */
             lh->error++;
+            lh->num_nodes--;
             lh->p = 0;
             return;
         }