* gc-gnulib.c, gc-libgcrypt.c: Check calloc return value.
authorSimon Josefsson <simon@josefsson.org>
Fri, 28 Oct 2005 12:13:27 +0000 (12:13 +0000)
committerSimon Josefsson <simon@josefsson.org>
Fri, 28 Oct 2005 12:13:27 +0000 (12:13 +0000)
lib/ChangeLog
lib/gc-gnulib.c
lib/gc-libgcrypt.c

index 6a30f1e..9e2db39 100644 (file)
@@ -1,5 +1,7 @@
 2005-10-28  Simon Josefsson  <jas@extundo.com>
 
+       * 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
index 61143b0..c0fa2e3 100644 (file)
@@ -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;
index bc0d12b..10841e8 100644 (file)
@@ -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;