summaryrefslogtreecommitdiff
path: root/src/journal
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-10-16 18:28:30 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-10-16 23:35:39 -0400
commit6b430fdb7c0c2c52ea69a7d56f23d739218b13d0 (patch)
tree5ddb3975a8146fbee7c114e41a967e2abf9caa11 /src/journal
parentd7604756ca5888350d5ed4ab6867baa967b24299 (diff)
tree-wide: use mfree more
Diffstat (limited to 'src/journal')
-rw-r--r--src/journal/journal-file.c3
-rw-r--r--src/journal/mmap-cache.c6
-rw-r--r--src/journal/sd-journal.c9
3 files changed, 6 insertions, 12 deletions
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index 49199b269f..d3e0214731 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -394,8 +394,7 @@ JournalFile* journal_file_close(JournalFile *f) {
gcry_md_close(f->hmac);
#endif
- free(f);
- return NULL;
+ return mfree(f);
}
void journal_file_close_set(Set *s) {
diff --git a/src/journal/mmap-cache.c b/src/journal/mmap-cache.c
index 293d27053a..d91247b524 100644
--- a/src/journal/mmap-cache.c
+++ b/src/journal/mmap-cache.c
@@ -325,10 +325,8 @@ static FileDescriptor* fd_add(MMapCache *m, int fd) {
f->fd = fd;
r = hashmap_put(m->fds, FD_TO_PTR(fd), f);
- if (r < 0) {
- free(f);
- return NULL;
- }
+ if (r < 0)
+ return mfree(f);
return f;
}
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index 98c8a47afe..f2f8546086 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -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);