From: Simon Josefsson Date: Fri, 28 Oct 2005 12:13:27 +0000 (+0000) Subject: * gc-gnulib.c, gc-libgcrypt.c: Check calloc return value. X-Git-Tag: cvs-readonly~2754 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=d0299ff4fc16cda1ba3c9e1913bd31f31ccb261f;p=gnulib.git * gc-gnulib.c, gc-libgcrypt.c: Check calloc return value. --- diff --git a/lib/ChangeLog b/lib/ChangeLog index 6a30f1e95..9e2db3977 100644 --- 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 index 61143b0de..c0fa2e3e2 100644 --- a/lib/gc-gnulib.c +++ b/lib/gc-gnulib.c @@ -192,6 +192,8 @@ gc_cipher_open (Gc_cipher alg, Gc_cipher_mode mode, 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 index bc0d12bba..10841e8d4 100644 --- a/lib/gc-libgcrypt.c +++ b/lib/gc-libgcrypt.c @@ -243,6 +243,8 @@ gc_hash_open (Gc_hash hash, Gc_hash_mode mode, gc_hash_handle * outhandle) Gc_rc rc = GC_OK; ctx = calloc (sizeof (*ctx), 1); + if (!ctx) + return GC_MALLOC_ERROR; ctx->alg = hash; ctx->mode = mode;