]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: httpclient-cli: fix uninit variable in error label
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 19 May 2026 16:26:18 +0000 (18:26 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 19 May 2026 16:33:13 +0000 (18:33 +0200)
commit50354f929dd22cd2c34db723918667050b20b9a8
treeec86923d74515b983037bd162b38441aec91cc93
parent6f6bf3feccd18a52863289604714d1af5a5613a1
BUG/MINOR: httpclient-cli: fix uninit variable in error label

The following patch fixes a leak in case of httpclient_start() failure
in the httpclient_cli code by adding httpclient_destroy() call on error
path.

  c53256adbc17bb76840fdc8213cf8854454d850b
  BUG/MINOR: httpclient-cli: Destroy http-client context if failing to start it

However, error label may be selected prior to httpclient allocation if
CLI arguments are incorrect. This can cause a crash due to a deferencing
of an uninitialized variable. This has been detected via a compilation
error :

  src/httpclient_cli.c: In function 'hc_cli_parse':
  src/httpclient_cli.c:162:2: error: 'hc' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    162 |  httpclient_destroy(hc);
        |  ^~~~~~~~~~~~~~~~~~~~~~

This must be backported along the above patch, which is scheduled up to
the 2.6 release.
src/httpclient_cli.c