* 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 6a30f1e95122b0267fd94fa35d0ad1508a873dd8..9e2db39770f607ef854127706cf4e040cb69b173 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 61143b0de28a286508278285bf9931215e2fb1a2..c0fa2e3e2c6e4f6e8ca7afe09194f65edf742265 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 bc0d12bbaf6b16aae69cafde317effe89dba9252..10841e8d43ada764c9e4a64d27c10d3a45811bcb 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;