]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-journal: free incomplete match on failure
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 23 Dec 2021 12:35:29 +0000 (21:35 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 23 Dec 2021 12:35:29 +0000 (21:35 +0900)
src/libsystemd/sd-journal/sd-journal.c

index efaa2bf501dac9b9bf1178aaa36b5878698f7f25..28a6e31a9f0fd954d4856577371df5b7983e9c0a 100644 (file)
@@ -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);