diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-09-13 22:30:26 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-09-13 22:30:26 +0200 |
commit | 2fbe635a83a79f8889afec421ae3990ea106fb91 (patch) | |
tree | 99789cfa152da47458500fd09e978a7f9099e46d /src/core/load-fragment.c | |
parent | a1d41e17a5c3861becd66f1c9dba7eb39ae4c478 (diff) |
macro: introduce _cleanup_free_ macro for automatic freeing of scoped vars and make use of it
Diffstat (limited to 'src/core/load-fragment.c')
-rw-r--r-- | src/core/load-fragment.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 482d28b795..1f3da70aca 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -1469,7 +1469,7 @@ int config_parse_unit_condition_path( Unit *u = data; bool trigger, negate; Condition *c; - char *p; + _cleanup_free_ char *p = NULL; assert(filename); assert(lvalue); @@ -1496,7 +1496,6 @@ int config_parse_unit_condition_path( c = condition_new(cond, p, trigger, negate); if (!c) return -ENOMEM; - free(p); LIST_PREPEND(Condition, conditions, u->conditions, c); return 0; @@ -1516,7 +1515,7 @@ int config_parse_unit_condition_string( Unit *u = data; bool trigger, negate; Condition *c; - char *s; + _cleanup_free_ char *s = NULL; assert(filename); assert(lvalue); @@ -1538,7 +1537,6 @@ int config_parse_unit_condition_string( c = condition_new(cond, s, trigger, negate); if (!c) return log_oom(); - free(s); LIST_PREPEND(Condition, conditions, u->conditions, c); return 0; |