aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2001-03-15 11:33:00 +0000
committerBodo Möller <bodo@openssl.org>2001-03-15 11:33:00 +0000
commitba61b14f1d5f52026908d316d7564652dbaf1978 (patch)
treeca128f3a35b553aa045ae9052374d388009e71f0
parent5114966e00389b700290321611f8e854db01c1b4 (diff)
downloadopenssl-ba61b14f1d5f52026908d316d7564652dbaf1978.tar.gz
More err_data memory leaks
-rw-r--r--CHANGES3
-rw-r--r--crypto/err/err.c11
2 files changed, 7 insertions, 7 deletions
diff --git a/CHANGES b/CHANGES
index b2075c769e..f943fa1113 100644
--- a/CHANGES
+++ b/CHANGES
@@ -4,7 +4,8 @@
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.
+ *) Fix memory leaks in err.c: free err_data string if necessary;
+ don't write to the wrong index in ERR_set_error_data.
[Bodo Moeller]
*) Implement ssl23_peek (analogous to ssl23_read), which previously
diff --git a/crypto/err/err.c b/crypto/err/err.c
index 7579c9cea8..be4a71ed06 100644
--- a/crypto/err/err.c
+++ b/crypto/err/err.c
@@ -387,20 +387,18 @@ void ERR_put_error(int lib, int func, int reason, const char *file,
void ERR_clear_error(void)
{
+ int i;
ERR_STATE *es;
es=ERR_get_state();
-#if 0
- /* hmm... is this needed */
for (i=0; i<ERR_NUM_ERRORS; i++)
{
es->err_buffer[i]=0;
+ err_clear_data(es,i);
es->err_file[i]=NULL;
es->err_line[i]= -1;
- err_clear_data(es,i);
}
-#endif
es->top=es->bottom=0;
}
@@ -754,8 +752,9 @@ void ERR_set_error_data(char *data, int flags)
if (i == 0)
i=ERR_NUM_ERRORS-1;
+ err_clear_data(es,i);
es->err_data[i]=data;
- es->err_data_flags[es->top]=flags;
+ es->err_data_flags[i]=flags;
}
void ERR_add_error_data(int num, ...)
@@ -764,7 +763,7 @@ void ERR_add_error_data(int num, ...)
int i,n,s;
char *str,*p,*a;
- s=64;
+ s=80;
str=OPENSSL_malloc(s+1);
if (str == NULL) return;
str[0]='\0';