]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: haterm: missing allocation check in copy_argv()
authorFrederic Lecaille <flecaille@haproxy.com>
Fri, 20 Feb 2026 11:12:10 +0000 (12:12 +0100)
committerFrederic Lecaille <flecaille@haproxy.com>
Fri, 20 Feb 2026 11:12:10 +0000 (12:12 +0100)
This is a very minor bug with a very low probability of occurring.
However, it could be flagged by a static analyzer or result in a small
contribution, which is always time-consuming for very little gain.

src/haterm_init.c

index 1eacd900eca28bc599c752b1d31ac42d83ccef6c..65baad54fa70bbc606ba9c4fff14aca24b6ea3f2 100644 (file)
@@ -474,6 +474,9 @@ void haproxy_init_args(int argc, char **argv)
 char **copy_argv(int argc, char **argv)
 {
        char **ret = calloc(1, sizeof(*ret));
-       *ret = strdup("");
+
+       if (*ret)
+               *ret = strdup("");
+
        return ret;
 }