From df45fec39343d8a32c1a6416a5570f98675c942a Mon Sep 17 00:00:00 2001 From: Love Hornquist Astrand Date: Sun, 30 May 2010 15:39:12 -0700 Subject: [PATCH] plug memory leak --- lib/krb5/error_string.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/krb5/error_string.c b/lib/krb5/error_string.c index 64738fc68..237d346f4 100644 --- a/lib/krb5/error_string.c +++ b/lib/krb5/error_string.c @@ -98,11 +98,14 @@ krb5_vset_error_message (krb5_context context, krb5_error_code ret, { int r; - krb5_clear_error_message(context); HEIMDAL_MUTEX_lock(context->mutex); + if (context->error_string) { + free(context->error_string); + context->error_string = NULL; + } context->error_code = ret; r = vasprintf(&context->error_string, fmt, args); - if (r) + if (r < 0) context->error_string = NULL; HEIMDAL_MUTEX_unlock(context->mutex); }