diff options
author | Maciej Wereski <m.wereski@partner.samsung.com> | 2013-07-19 15:43:12 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-07-19 09:57:04 -0400 |
commit | e2f2fb786059fbed410938f16e5cc8b851366b14 (patch) | |
tree | 2cdb611aa3533ccbb9b30a1118b736bfa3f768bf /src/tmpfiles | |
parent | ef89eef77ee098a6828169a6d0d74128e236bcbd (diff) |
tmpfiles: Fix memory leak in parse_line()
Diffstat (limited to 'src/tmpfiles')
-rw-r--r-- | src/tmpfiles/tmpfiles.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 555347ac36..eae993e6b6 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -971,6 +971,12 @@ static void item_free(Item *i) { free(i); } +static inline void item_freep(Item **i) { + if (*i) + item_free(*i); +} +#define _cleanup_item_free_ _cleanup_(item_freep) + static bool item_equal(Item *a, Item *b) { assert(a); assert(b); @@ -1013,7 +1019,7 @@ static bool item_equal(Item *a, Item *b) { } static int parse_line(const char *fname, unsigned line, const char *buffer) { - _cleanup_free_ Item *i = NULL; + _cleanup_item_free_ Item *i = NULL; Item *existing; _cleanup_free_ char *mode = NULL, *user = NULL, *group = NULL, *age = NULL; |