]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
conf-parser: use _cleanup_free_ where appropriate
authorLennart Poettering <lennart@poettering.net>
Wed, 9 Feb 2022 08:47:10 +0000 (09:47 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 9 Feb 2022 09:17:13 +0000 (10:17 +0100)
src/shared/conf-parser.c

index bc80eaffeb93960d1dd21728fa74959bec99f6d0..1de8eb9474848d931d107d0ce25333f2f8ec4c00 100644 (file)
@@ -180,9 +180,9 @@ static int parse_line(
         if (!utf8_is_valid(l))
                 return log_syntax_invalid_utf8(unit, LOG_WARNING, filename, line, l);
 
-        if (*l == '[') {
+        if (l[0] == '[') {
+                _cleanup_free_ char *n = NULL;
                 size_t k;
-                char *n;
 
                 k = strlen(l);
                 assert(k > 0);
@@ -210,7 +210,6 @@ static int parse_line(
                         if (!ignore)
                                 log_syntax(unit, LOG_WARNING, filename, line, 0, "Unknown section '%s'. Ignoring.", n);
 
-                        free(n);
                         *section = mfree(*section);
                         *section_line = 0;
                         *section_ignored = true;