From: Yu Watanabe Date: Thu, 23 Dec 2021 12:35:29 +0000 (+0900) Subject: sd-journal: free incomplete match on failure X-Git-Tag: v250~2^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=418cce628cf28d4feaeda60241cf9781f8afbf1c;p=thirdparty%2Fsystemd.git sd-journal: free incomplete match on failure --- diff --git a/src/libsystemd/sd-journal/sd-journal.c b/src/libsystemd/sd-journal/sd-journal.c index efaa2bf501d..28a6e31a9f0 100644 --- a/src/libsystemd/sd-journal/sd-journal.c +++ b/src/libsystemd/sd-journal/sd-journal.c @@ -233,7 +233,7 @@ static void match_free_if_empty(Match *m) { } _public_ int sd_journal_add_match(sd_journal *j, const void *data, size_t size) { - Match *l3, *l4, *add_here = NULL, *m; + Match *l3, *l4, *add_here = NULL, *m = NULL; uint64_t hash; assert_return(j, -EINVAL); @@ -322,6 +322,7 @@ _public_ int sd_journal_add_match(sd_journal *j, const void *data, size_t size) return 0; fail: + match_free(m); match_free_if_empty(add_here); match_free_if_empty(j->level2); match_free_if_empty(j->level1);