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.
This commit is contained in:
Willy Tarreau 2015-10-07 20:00:24 +02:00
parent 8c1ad716df
commit 6457d0fac3

View 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;
}
}