LIBGCRYPT-1-2-BRANCH libgcrypt (doc/ChangeLog doc/gcrypt.texi
src/ChangeLog src/global.c)
cvs user wk
cvs at cvs.gnupg.org
Tue Feb 22 18:48:05 CET 2005
Date: Tuesday, February 22, 2005 @ 18:59:21
Author: wk
Path: /cvs/libgcrypt/libgcrypt
Tag: LIBGCRYPT-1-2-BRANCH
Modified: doc/ChangeLog doc/gcrypt.texi src/ChangeLog src/global.c
(_gcry_malloc): Make sure ERRNO is set if we return
NULL. Remove unneeded initialization of M to allow the compiler
to catch errors.
(gcry_realloc): Make sure ERRNO is set if we return NULL.
-----------------+
doc/ChangeLog | 4 ++++
doc/gcrypt.texi | 2 +-
src/ChangeLog | 9 ++++++++-
src/global.c | 24 +++++++++++++++++-------
4 files changed, 30 insertions(+), 9 deletions(-)
Index: libgcrypt/doc/ChangeLog
diff -u libgcrypt/doc/ChangeLog:1.38.2.4 libgcrypt/doc/ChangeLog:1.38.2.5
--- libgcrypt/doc/ChangeLog:1.38.2.4 Thu Feb 3 20:52:55 2005
+++ libgcrypt/doc/ChangeLog Tue Feb 22 18:59:21 2005
@@ -1,3 +1,7 @@
+2005-02-08 Werner Koch <wk at g10code.com>
+
+ * gcrypt.texi: Fixed direntry.
+
2005-02-03 Moritz Schulte <moritz at g10code.com>
* gcrypt.texi: Fixed several typos; thanks to Michele Baldessari.
Index: libgcrypt/doc/gcrypt.texi
diff -u libgcrypt/doc/gcrypt.texi:1.38.2.4 libgcrypt/doc/gcrypt.texi:1.38.2.5
--- libgcrypt/doc/gcrypt.texi:1.38.2.4 Thu Feb 3 20:52:55 2005
+++ libgcrypt/doc/gcrypt.texi Tue Feb 22 18:59:21 2005
@@ -25,7 +25,7 @@
@dircategory GNU Libraries
@direntry
-* libgcrypt: (gcrypt) Cryptographic function library.
+* libgcrypt: (gcrypt). Cryptographic function library.
@end direntry
Index: libgcrypt/src/ChangeLog
diff -u libgcrypt/src/ChangeLog:1.151.2.11 libgcrypt/src/ChangeLog:1.151.2.12
--- libgcrypt/src/ChangeLog:1.151.2.11 Wed Jan 5 14:52:33 2005
+++ libgcrypt/src/ChangeLog Tue Feb 22 18:59:21 2005
@@ -1,3 +1,10 @@
+2005-02-22 Werner Koch <wk at g10code.com>
+
+ * global.c (_gcry_malloc): Make sure ERRNO is set if we return
+ NULL. Remove unneeded initialization of M to allow the compiler
+ to catch errors.
+ (gcry_realloc): Make sure ERRNO is set if we return NULL.
+
2005-01-05 Werner Koch <wk at g10code.com>
* gcrypt.h: Added GCRYCTL_FAST_POLL.
@@ -1392,7 +1399,7 @@
Copyright (C) 1998,1999,2000,2001,2002,2003
- 2004 Free Software Foundation, Inc.
+ 2004,2005 Free Software Foundation, Inc.
This file is free software; as a special exception the author gives
unlimited permission to copy and/or distribute it, with or without
Index: libgcrypt/src/global.c
diff -u libgcrypt/src/global.c:1.45.2.2 libgcrypt/src/global.c:1.45.2.3
--- libgcrypt/src/global.c:1.45.2.2 Wed Jan 5 14:52:33 2005
+++ libgcrypt/src/global.c Tue Feb 22 18:59:21 2005
@@ -1,6 +1,6 @@
/* global.c - global control functions
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
- * 2004 Free Software Foundation, Inc.
+ * 2004, 2005 Free Software Foundation, Inc.
*
* This file is part of Libgcrypt.
*
@@ -387,8 +387,8 @@
gcry_err_code_t
_gcry_malloc (size_t n, unsigned int flags, void **mem)
{
- gcry_err_code_t err = GPG_ERR_NO_ERROR;
- void *m = NULL;
+ gcry_err_code_t err = 0;
+ void *m;
if ((flags & GCRY_ALLOC_FLAG_SECURE) && !no_secure_memory)
{
@@ -405,8 +405,12 @@
m = _gcry_private_malloc (n);
}
- if (! m)
- err = gpg_err_code_from_errno (ENOMEM);
+ if (!m)
+ {
+ if (!errno)
+ errno = ENOMEM;
+ err = gpg_err_code_from_errno (errno);
+ }
else
*mem = m;
@@ -458,9 +462,15 @@
void *
gcry_realloc (void *a, size_t n)
{
+ void *p;
+
if (realloc_func)
- return realloc_func (a, n);
- return _gcry_private_realloc (a, n);
+ p = realloc_func (a, n);
+ else
+ p = _gcry_private_realloc (a, n);
+ if (!p && !errno)
+ errno = ENOMEM;
+ return p;
}
void
More information about the Gnupg-commits
mailing list