[git] GCRYPT - branch, master, updated. post-nuke-of-trailing-ws-22-g934d270

by Werner Koch cvs at cvs.gnupg.org
Fri Apr 1 10:46:35 CEST 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU crypto library".

The branch, master has been updated
       via  934d270ff8193a5931b143ce850f66f50d03dedf (commit)
      from  ec033383618c4b3739783d31ca4dc70c9bb4fcfe (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 934d270ff8193a5931b143ce850f66f50d03dedf
Author: Werner Koch <wk at gnupg.org>
Date:   Fri Apr 1 10:16:31 2011 +0200

    Make sure that gcry_realloc (NULL, n) works on all platforms.
    
    realloc (NULL, n) shall behave exactly like malloc (n)
    and realloc (p, 0) like free.
    
    Not all platforms implement this correctly thus we now handle this
    directly in gcry_realloc.

diff --git a/src/ChangeLog b/src/ChangeLog
index 9ef6c5d..9476e82 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+2011-04-01  Werner Koch  <wk at g10code.com>
+
+	* global.c (gcry_realloc): Divert to gcry_malloc or gcry_free.
+
 2011-03-09  Werner Koch  <wk at g10code.com>
 
 	* gcrypt.h.in (gcry_kdf_algos): New.
diff --git a/src/global.c b/src/global.c
index cbb7eb8..d65b068 100644
--- a/src/global.c
+++ b/src/global.c
@@ -833,6 +833,16 @@ gcry_realloc (void *a, size_t n)
 {
   void *p;
 
+  /* To avoid problems with non-standard realloc implementations and
+     our own secmem_realloc, we divert to malloc and free here.  */
+  if (!a)
+    return gcry_malloc (n);
+  if (!n)
+    {
+      gcry_free (a);
+      return NULL;
+    }
+
   if (realloc_func)
     p = realloc_func (a, n);
   else

-----------------------------------------------------------------------

Summary of changes:
 src/ChangeLog |    4 ++++
 src/global.c  |   10 ++++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
The GNU crypto library
http://git.gnupg.org




More information about the Gnupg-commits mailing list