From: Bernd Edlinger Date: Sun, 9 Jul 2017 19:22:26 +0000 (+0200) Subject: Fix crash in BUF_MEM_grow_clean. X-Git-Tag: OpenSSL_1_1_1-pre1~1069 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=e1ca9e1f6db97052a0ebea6591f323b12b1e0020;p=oweals%2Fopenssl.git Fix crash in BUF_MEM_grow_clean. Reviewed-by: Tim Hudson Reviewed-by: Ben Kaduk (Merged from https://github.com/openssl/openssl/pull/3896) --- 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); }