]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: cli: ensure we can never double-free error messages
authorWilly Tarreau <w@1wt.eu>
Wed, 7 Oct 2015 18:00:24 +0000 (20:00 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 7 Oct 2015 18:00:24 +0000 (20:00 +0200)
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

index ff4412073cbbb794f37edc526de2840e660de78b..fd1d1232f2ae66f21e64956160b93fde4562282b 100644 (file)
@@ -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;
        }
 }