summaryrefslogtreecommitdiffstats
path: root/src/tmpfiles
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-10-25 13:57:44 +0200
committerLennart Poettering <lennart@poettering.net>2018-11-08 09:52:16 +0100
commitccd114f0f9d6bf9b11e5efc0127f7345f98356be (patch)
tree7431c5bc5fc644c6895b02b8a199cdb086e75ec9 /src/tmpfiles
parenttmpfiles: use free_and_replace() where appropriate (diff)
downloadsystemd-ccd114f0f9d6bf9b11e5efc0127f7345f98356be.tar.xz
systemd-ccd114f0f9d6bf9b11e5efc0127f7345f98356be.zip
tmpfiles: fix minor memory leak on error path
Diffstat (limited to 'src/tmpfiles')
-rw-r--r--src/tmpfiles/tmpfiles.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index 67060e57c1..cc5cbc382f 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -2792,8 +2792,10 @@ static int parse_line(const char *fname, unsigned line, const char *buffer, bool
return log_oom();
r = ordered_hashmap_put(h, i.path, existing);
- if (r < 0)
+ if (r < 0) {
+ free(existing);
return log_oom();
+ }
}
if (!GREEDY_REALLOC(existing->items, existing->allocated, existing->n_items + 1))