From d0299ff4fc16cda1ba3c9e1913bd31f31ccb261f Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Fri, 28 Oct 2005 12:13:27 +0000 Subject: [PATCH] * gc-gnulib.c, gc-libgcrypt.c: Check calloc return value. --- lib/ChangeLog | 2 ++ lib/gc-gnulib.c | 2 ++ lib/gc-libgcrypt.c | 2 ++ 3 files changed, 6 insertions(+) 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; -- 2.11.0