From: Lennart Poettering Date: Wed, 9 Feb 2022 08:47:10 +0000 (+0100) Subject: conf-parser: use _cleanup_free_ where appropriate X-Git-Tag: v251-rc1~319^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=deec0b6dd53486809e25c70716dc8e5e5d168915;p=thirdparty%2Fsystemd.git conf-parser: use _cleanup_free_ where appropriate --- diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c index bc80eaffeb9..1de8eb94748 100644 --- a/src/shared/conf-parser.c +++ b/src/shared/conf-parser.c @@ -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;