summaryrefslogtreecommitdiff
path: root/src/global.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/global.c')
-rw-r--r--src/global.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/global.c b/src/global.c
index cbb7eb89..d65b0680 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