]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
conf-parse: use free_and_replace()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 3 Jun 2018 15:30:36 +0000 (00:30 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 3 Jun 2018 15:30:42 +0000 (00:30 +0900)
Also removes unnecessary empty lines.

src/shared/conf-parser.c

index 159b923e9c8e627e3d7b4900f949ade3819bce53..1057c59a1104a7422573c82a2217a9df3528ecba 100644 (file)
@@ -240,8 +240,7 @@ static int parse_line(
                         *section_line = 0;
                         *section_ignored = true;
                 } else {
-                        free(*section);
-                        *section = n;
+                        free_and_replace(*section, n);
                         *section_line = line;
                         *section_ignored = false;
                 }
@@ -399,7 +398,6 @@ int config_parse(const char *unit,
                         if (flags & CONFIG_PARSE_WARN)
                                 log_warning_errno(r, "%s:%u: Failed to parse file: %m", filename, line);
                         return r;
-
                 }
 
                 continuation = mfree(continuation);
@@ -422,7 +420,6 @@ int config_parse(const char *unit,
                         if (flags & CONFIG_PARSE_WARN)
                                 log_warning_errno(r, "%s:%u: Failed to parse file: %m", filename, line);
                         return r;
-
                 }
         }