summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaciej Wereski <m.wereski@partner.samsung.com>2013-07-19 15:43:12 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-07-19 09:57:04 -0400
commite2f2fb786059fbed410938f16e5cc8b851366b14 (patch)
tree2cdb611aa3533ccbb9b30a1118b736bfa3f768bf /src
parentef89eef77ee098a6828169a6d0d74128e236bcbd (diff)
tmpfiles: Fix memory leak in parse_line()
Diffstat (limited to 'src')
-rw-r--r--src/tmpfiles/tmpfiles.c8
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;