From fa477630c69d155b61397375d4769c55bb9d3e14 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Sun, 27 Nov 2011 14:15:18 +0100 Subject: [PATCH] fix one possible NULL bug in d0_bignum-gmp --- d0_bignum-gmp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/d0_bignum-gmp.c b/d0_bignum-gmp.c index 95b95e2..d5da8b5 100644 --- a/d0_bignum-gmp.c +++ b/d0_bignum-gmp.c @@ -74,7 +74,8 @@ static void *reallocate_function (void *ptr, size_t old_size, size_t new_size) if(old_size == new_size) return ptr; data = d0_malloc(new_size); - memcpy(data, ptr, (old_size < new_size) ? old_size : new_size); + if(ptr && data) + memcpy(data, ptr, (old_size < new_size) ? old_size : new_size); d0_free(ptr); return data; } -- 2.39.2