]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/journal/sd-journal.c
tree-wide: use mfree more
[thirdparty/systemd.git] / src / journal / sd-journal.c
index 98c8a47afeb2817c5dded98af4daf1e7d680e7df..f2f854608638f878d0f9acaaa0f7517f4d7fba65 100644 (file)
@@ -387,7 +387,7 @@ _public_ int sd_journal_add_disjunction(sd_journal *j) {
 }
 
 static char *match_make_string(Match *m) {
-        char *p, *r;
+        char *p = NULL, *r;
         Match *i;
         bool enclose = false;
 
@@ -397,15 +397,12 @@ static char *match_make_string(Match *m) {
         if (m->type == MATCH_DISCRETE)
                 return strndup(m->data, m->size);
 
-        p = NULL;
         LIST_FOREACH(matches, i, m->matches) {
                 char *t, *k;
 
                 t = match_make_string(i);
-                if (!t) {
-                        free(p);
-                        return NULL;
-                }
+                if (!t)
+                        return mfree(p);
 
                 if (p) {
                         k = strjoin(p, m->type == MATCH_OR_TERM ? " OR " : " AND ", t, NULL);