changeset 6432:13e8dcd2e4d7

* gc-gnulib.c, gc-libgcrypt.c: Check calloc return value.
author Simon Josefsson <simon@josefsson.org>
date Fri, 28 Oct 2005 12:13:27 +0000
parents 076accb971ef
children 9ae35a6dccf5
files lib/ChangeLog lib/gc-gnulib.c lib/gc-libgcrypt.c
diffstat 3 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -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
--- 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;
--- 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;