From: Yu Watanabe Date: Wed, 4 Oct 2017 06:21:12 +0000 (+0900) Subject: load-fragment: do not create empty array X-Git-Tag: v235~28^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9f2d41a65fb8671c5746a952c1917da8f2774bc8;p=thirdparty%2Fsystemd.git load-fragment: do not create empty array Originally added in 4589f5bb0a973e9a41be93de06c87072cea4dfb9. C.f. 8249bb728db6c2abaf12575d661b52571bdc1ab1 and #6746. --- diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 2c3783a9f0d..5dd1787098e 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -284,19 +284,7 @@ int config_parse_unit_path_strv_printf( assert(u); if (isempty(rvalue)) { - char **empty; - - /* Empty assignment resets the list. As a special rule - * we actually fill in a real empty array here rather - * than NULL, since some code wants to know if - * something was set at all... */ - empty = new0(char*, 1); - if (!empty) - return log_oom(); - - strv_free(*x); - *x = empty; - + *x = strv_free(*x); return 0; } @@ -1968,15 +1956,7 @@ int config_parse_user_group_strv( assert(u); if (isempty(rvalue)) { - char **empty; - - empty = new0(char*, 1); - if (!empty) - return log_oom(); - - strv_free(*users); - *users = empty; - + *users = strv_free(*users); return 0; }