]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: fix free undefined pointer when strdup failed in the first loop
authorxujing <17826839720@163.com>
Wed, 8 Sep 2021 06:26:20 +0000 (14:26 +0800)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 8 Sep 2021 13:42:22 +0000 (22:42 +0900)
src/core/load-fragment.c

index 92815b1dbaeab966226fe747f03596f4f87ab7a1..1c8159a235506730e4b62e5ea688690bf4fc98df 100644 (file)
@@ -800,7 +800,7 @@ int config_parse_exec(
                 if (!separate_argv0) {
                         char *w = NULL;
 
-                        if (!GREEDY_REALLOC(n, nlen + 2))
+                        if (!GREEDY_REALLOC0(n, nlen + 2))
                                 return log_oom();
 
                         w = strdup(path);
@@ -832,7 +832,7 @@ int config_parse_exec(
                                 p += 2;
                                 p += strspn(p, WHITESPACE);
 
-                                if (!GREEDY_REALLOC(n, nlen + 2))
+                                if (!GREEDY_REALLOC0(n, nlen + 2))
                                         return log_oom();
 
                                 w = strdup(";");