From f01c2d2ca04009c74353f4587a7bff22f9f7fb92 Mon Sep 17 00:00:00 2001 From: "git@daemon.de" Date: Mon, 5 May 2014 12:00:56 +0200 Subject: [PATCH] fixed invalid handling of pcp_err saving (crashed) --- libpcp/context.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libpcp/context.c b/libpcp/context.c index e984f6f..c543303 100644 --- a/libpcp/context.c +++ b/libpcp/context.c @@ -57,11 +57,15 @@ void fatal(PCPCTX *ptx, const char * fmt, ...) { va_list ap; va_start(ap, fmt); - char *err = ptx->pcp_err; + char *err = NULL;//ptx->pcp_err; if(vasprintf(&err, fmt, ap) >= 0) { va_end(ap); ptx->pcp_errset = 1; + if(ptx->pcp_err != NULL) { + free(ptx->pcp_err); + } + ptx->pcp_err = err; } else { fprintf(stderr, "Could not store fatal error message %s!\n", fmt);