chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tmpfiles: Fix memory leak in parse_line()
[elogind.git]
/
src
/
tmpfiles
/
tmpfiles.c
diff --git
a/src/tmpfiles/tmpfiles.c
b/src/tmpfiles/tmpfiles.c
index 555347ac36ec70e9084b7a65a4f81664f30a4cb3..eae993e6b690f630e1d201672b7525ee0ab153bb 100644
(file)
--- a/
src/tmpfiles/tmpfiles.c
+++ b/
src/tmpfiles/tmpfiles.c
@@
-971,6
+971,12
@@
static void item_free(Item *i) {
free(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);
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) {
}
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;
Item *existing;
_cleanup_free_ char
*mode = NULL, *user = NULL, *group = NULL, *age = NULL;