From: Willy Tarreau Date: Wed, 7 Oct 2015 18:00:24 +0000 (+0200) Subject: CLEANUP: cli: ensure we can never double-free error messages X-Git-Tag: v1.6.0~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6457d0fac304b7bba3e8af13501bf5ecf82bfa67;p=thirdparty%2Fhaproxy.git CLEANUP: cli: ensure we can never double-free error messages The release handler used to be called twice for some time and just by pure luck we never ended up double-freeing the data there. Add a NULL to ensure this can never happen should a future change permit this situation again. --- diff --git a/src/dumpstats.c b/src/dumpstats.c index ff4412073c..fd1d1232f2 100644 --- a/src/dumpstats.c +++ b/src/dumpstats.c @@ -6155,9 +6155,11 @@ static void cli_release_handler(struct appctx *appctx) } else if (appctx->st0 == STAT_CLI_PRINT_FREE) { free(appctx->ctx.cli.err); + appctx->ctx.cli.err = NULL; } else if (appctx->st0 == STAT_CLI_O_MLOOK) { free(appctx->ctx.map.chunk.str); + appctx->ctx.map.chunk.str = NULL; } }