From 6457d0fac304b7bba3e8af13501bf5ecf82bfa67 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 7 Oct 2015 20:00:24 +0200 Subject: [PATCH] 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. --- src/dumpstats.c | 2 ++ 1 file changed, 2 insertions(+) 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; } } -- 2.39.5