fix memory leak in err.c
authorBodo Möller <bodo@openssl.org>
Mon, 12 Mar 2001 18:39:47 +0000 (18:39 +0000)
committerBodo Möller <bodo@openssl.org>
Mon, 12 Mar 2001 18:39:47 +0000 (18:39 +0000)
CHANGES
crypto/err/err.c

diff --git a/CHANGES b/CHANGES
index fb3e069d579da6944e229d82a227507b72238522..b2075c769e7c0e743368c73459894ab9421c4c6f 100644 (file)
--- 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]
index bfecb86c754b65b23cfd8fe98337cdd68700217a..74242b62fc2108f8a414158a66c30a8c1f73d285 100644 (file)
@@ -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)
                        {