From 2c89d56a1d5f2620532db13f21cfbbdf92cc4052 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bodo=20M=C3=B6ller?= Date: Mon, 12 Mar 2001 18:39:47 +0000 Subject: [PATCH] fix memory leak in err.c --- CHANGES | 3 +++ crypto/err/err.c | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) 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) { -- 2.25.1