From: Willy Tarreau Date: Sun, 26 Apr 2026 21:55:03 +0000 (+0200) Subject: BUG/MINOR: sample: fix memory leak in smp_resolve_args error paths X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=7465b5ec38bde3c9c7101002881a3d070af0e2bb;p=thirdparty%2Fhaproxy.git BUG/MINOR: sample: fix memory leak in smp_resolve_args error paths Several error paths in smp_resolve_args used 'continue' which skipped LIST_DELETE and free(cur), leaking the arg_list node. Changed all to 'break' to ensure proper cleanup on all error paths. This is harmless since when such issues are met, the process refuses to start, so no backport is really needed. --- diff --git a/src/sample.c b/src/sample.c index b6ec6ec77..154adbde8 100644 --- a/src/sample.c +++ b/src/sample.c @@ -1489,7 +1489,7 @@ int smp_resolve_args(struct proxy *p, char **err) cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id, err2); ha_free(&err2); cfgerr++; - continue; + break; } break; @@ -1499,7 +1499,7 @@ int smp_resolve_args(struct proxy *p, char **err) *err ? *err : "", cur->file, cur->line, cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id); cfgerr++; - continue; + break; } /* we support two formats : "bck/srv" and "srv" */ @@ -1682,7 +1682,7 @@ int smp_resolve_args(struct proxy *p, char **err) *err ? *err : "", cur->file, cur->line, cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id); cfgerr++; - continue; + break; } rflags = 0; @@ -1696,7 +1696,7 @@ int smp_resolve_args(struct proxy *p, char **err) cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id, err2); ha_free(&err2); cfgerr++; - continue; + break; } chunk_destroy(&arg->data.str);