From: Bodo Möller Date: Mon, 12 Mar 2001 18:39:47 +0000 (+0000) Subject: fix memory leak in err.c X-Git-Tag: OpenSSL_0_9_6a-beta1~6 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=2c89d56a1d5f2620532db13f21cfbbdf92cc4052;p=oweals%2Fopenssl.git fix memory leak in err.c --- diff --git a/CHANGES b/CHANGES index fb3e069d57..b2075c769e 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,9 @@ Changes between 0.9.6 and 0.9.6a [xx XXX 2001] + *) Fix a memory leak in err.c: free err_data string if necessary. + [Bodo Moeller] + *) Implement ssl23_peek (analogous to ssl23_read), which previously did not exist. [Bodo Moeller] diff --git a/crypto/err/err.c b/crypto/err/err.c index bfecb86c75..74242b62fc 100644 --- a/crypto/err/err.c +++ b/crypto/err/err.c @@ -462,7 +462,15 @@ static unsigned long get_error_values(int inc, const char **file, int *line, } } - if (data != NULL) + if (data == NULL) + { + if (inc && (es->err_data[i] != NULL) && (es->err_data_flags[i] & ERR_TXT_MALLOCED)) + { + OPENSSL_free(es->err_data[i]); + es->err_data[i] = NULL; + } + } + else { if (es->err_data[i] == NULL) {