sd-journal: free incomplete match on failure

This commit is contained in:
Yu Watanabe 2021-12-23 21:35:29 +09:00
parent a9c97bbbfb
commit 418cce628c

View 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);