summaryrefslogtreecommitdiff
path: root/src/global.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2008-12-05 18:53:06 +0000
committerWerner Koch <wk@gnupg.org>2008-12-05 18:53:06 +0000
commitbd5ca43389e2219b930d67ec51ad688650951e25 (patch)
tree3a7dc8c95a91fc0b7084b0c6199b68f47823ecb9 /src/global.c
parentdb0387be06f205591870e882c8a4ae0e0ebf0846 (diff)
downloadlibgcrypt-bd5ca43389e2219b930d67ec51ad688650951e25.tar.gz
Allow (transient-key) for DSA.
Type fix. Made sure that gcry_free preserves ERRNO.
Diffstat (limited to 'src/global.c')
-rw-r--r--src/global.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/global.c b/src/global.c
index d2361de5..a69513e7 100644
--- a/src/global.c
+++ b/src/global.c
@@ -810,15 +810,24 @@ gcry_realloc (void *a, size_t n)
}
void
-gcry_free( void *p )
+gcry_free (void *p)
{
- if( !p )
+ int save_errno;
+
+ if (!p)
return;
+ /* In case ERRNO is set we better save it so that the free machinery
+ may not accidently change ERRNO. We restore it only if it was
+ already set to comply with the usual C semantic for ERRNO. */
+ save_errno = errno;
if (free_func)
free_func (p);
else
_gcry_private_free (p);
+
+ if (save_errno)
+ errno = save_errno;
}
void *