From: xujing <17826839720@163.com> Date: Wed, 8 Sep 2021 06:26:20 +0000 (+0800) Subject: core: fix free undefined pointer when strdup failed in the first loop X-Git-Tag: v250-rc1~712 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1509274359979079e3e61899ce12fc8b0f0958d9;p=thirdparty%2Fsystemd.git core: fix free undefined pointer when strdup failed in the first loop --- diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 92815b1dbae..1c8159a2355 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -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(";");