diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2015-07-31 19:56:38 +0200 |
---|---|---|
committer | David Herrmann <dh.herrmann@gmail.com> | 2015-07-31 19:56:38 +0200 |
commit | 97b11eedff9d2e17101ad453caf9e48b73246719 (patch) | |
tree | add86c36a039f2cbeb8232908c7a0cb3ca784ea5 /src/journal | |
parent | b2a0ac5e5b29c73ca7c0da23369a4769d5a91ddd (diff) |
tree-wide: introduce mfree()
Pretty trivial helper which wraps free() but returns NULL, so we can
simplify this:
free(foobar);
foobar = NULL;
to this:
foobar = mfree(foobar);
Diffstat (limited to 'src/journal')
-rw-r--r-- | src/journal/catalog.c | 3 | ||||
-rw-r--r-- | src/journal/coredumpctl.c | 3 | ||||
-rw-r--r-- | src/journal/journalctl.c | 3 |
3 files changed, 3 insertions, 6 deletions
diff --git a/src/journal/catalog.c b/src/journal/catalog.c index 33b0539315..a3e51e2f52 100644 --- a/src/journal/catalog.c +++ b/src/journal/catalog.c @@ -263,8 +263,7 @@ int catalog_import_file(Hashmap *h, struct strbuf *sb, const char *path) { if (r < 0) return r; - free(lang); - lang = NULL; + lang = mfree(lang); } if (with_language) { diff --git a/src/journal/coredumpctl.c b/src/journal/coredumpctl.c index fc49b2e174..098f62af50 100644 --- a/src/journal/coredumpctl.c +++ b/src/journal/coredumpctl.c @@ -587,8 +587,7 @@ static int save_core(sd_journal *j, int fd, char **path, bool *unlink_temp) { if (filename && access(filename, R_OK) < 0) { log_full(errno == ENOENT ? LOG_DEBUG : LOG_WARNING, "File %s is not readable: %m", filename); - free(filename); - filename = NULL; + filename = mfree(filename); } if (filename && !endswith(filename, ".xz") && !endswith(filename, ".lz4")) { diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c index 073cc77711..355c4f1ee3 100644 --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c @@ -1259,8 +1259,7 @@ static int add_units(sd_journal *j) { } } - strv_free(patterns); - patterns = NULL; + patterns = strv_free(patterns); STRV_FOREACH(i, arg_user_units) { _cleanup_free_ char *u = NULL; |