summaryrefslogtreecommitdiffstats
path: root/crypto/buffer/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/buffer/buffer.c')
-rw-r--r--crypto/buffer/buffer.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/crypto/buffer/buffer.c b/crypto/buffer/buffer.c
index 6b0bd4a404..ad7128a732 100644
--- a/crypto/buffer/buffer.c
+++ b/crypto/buffer/buffer.c
@@ -62,9 +62,11 @@ static char *sec_alloc_realloc(BUF_MEM *str, size_t len)
ret = OPENSSL_secure_malloc(len);
if (str->data != NULL) {
- if (ret != NULL)
+ if (ret != NULL) {
memcpy(ret, str->data, str->length);
- OPENSSL_secure_free(str->data);
+ OPENSSL_secure_free(str->data);
+ str->data = NULL;
+ }
}
return (ret);
}