# HG changeset patch # User Simon Josefsson # Date 1130501607 0 # Node ID 13e8dcd2e4d77b9168e4ebedee18fa09eebdaf74 # Parent 076accb971ef3ba2efd31da079eccb2259c58c90 * gc-gnulib.c, gc-libgcrypt.c: Check calloc return value. diff --git a/lib/ChangeLog b/lib/ChangeLog --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,5 +1,7 @@ 2005-10-28 Simon Josefsson + * gc-gnulib.c, gc-libgcrypt.c: Check calloc return value. + * gc.h: Add MD2 and RMD160 length defines. Add prototypes. * gc-libgcrypt.c: Add MD2 (which is not available through diff --git a/lib/gc-gnulib.c b/lib/gc-gnulib.c --- a/lib/gc-gnulib.c +++ b/lib/gc-gnulib.c @@ -192,6 +192,8 @@ Gc_rc rc = GC_OK; ctx = calloc (sizeof (*ctx), 1); + if (!ctx) + return GC_MALLOC_ERROR; ctx->alg = alg; ctx->mode = mode; diff --git a/lib/gc-libgcrypt.c b/lib/gc-libgcrypt.c --- a/lib/gc-libgcrypt.c +++ b/lib/gc-libgcrypt.c @@ -243,6 +243,8 @@ Gc_rc rc = GC_OK; ctx = calloc (sizeof (*ctx), 1); + if (!ctx) + return GC_MALLOC_ERROR; ctx->alg = hash; ctx->mode = mode;