From eb4b4f87c250d3e2b6e6125f67a92161e8bb9cfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Mon, 1 May 2006 15:25:46 +0000 Subject: [PATCH] (hx509_set_error_stringv): clear errors on malloc failure git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17401 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/hx509/error.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/hx509/error.c b/lib/hx509/error.c index dd1e7d8a5..0ce18463a 100644 --- a/lib/hx509/error.c +++ b/lib/hx509/error.c @@ -65,8 +65,11 @@ hx509_set_error_stringv(hx509_context context, int flags, int code, hx509_error msg; msg = calloc(1, sizeof(*msg)); - if (msg == NULL) + if (msg == NULL) { + free_error_string(context->error); + context->error = NULL; return; + } if (vasprintf(&msg->msg, fmt, ap) == -1) { free(msg);