chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
40dde66
)
path: properly free PathSpec structs
author
Lennart Poettering
<lennart@poettering.net>
Mon, 15 Nov 2010 20:30:52 +0000
(21:30 +0100)
committer
Lennart Poettering
<lennart@poettering.net>
Mon, 15 Nov 2010 21:13:26 +0000
(22:13 +0100)
src/path.c
patch
|
blob
|
history
diff --git
a/src/path.c
b/src/path.c
index a8b10724495b6198d246d269122c44f1168f8304..cc8b79ad3304a64ce53b5b0b661775d3e91636ba 100644
(file)
--- a/
src/path.c
+++ b/
src/path.c
@@
-39,6
+39,17
@@
static const UnitActiveState state_translation_table[_PATH_STATE_MAX] = {
[PATH_FAILED] = UNIT_FAILED
};
[PATH_FAILED] = UNIT_FAILED
};
+static void path_unwatch_one(Path *p, PathSpec *s) {
+
+ if (s->inotify_fd < 0)
+ return;
+
+ unit_unwatch_fd(UNIT(p), &s->watch);
+
+ close_nointr_nofail(s->inotify_fd);
+ s->inotify_fd = -1;
+}
+
static void path_done(Unit *u) {
Path *p = PATH(u);
PathSpec *s;
static void path_done(Unit *u) {
Path *p = PATH(u);
PathSpec *s;
@@
-46,7
+57,9
@@
static void path_done(Unit *u) {
assert(p);
while ((s = p->specs)) {
assert(p);
while ((s = p->specs)) {
+ path_unwatch_one(p, s);
LIST_REMOVE(PathSpec, spec, p->specs, s);
LIST_REMOVE(PathSpec, spec, p->specs, s);
+ free(s->path);
free(s);
}
}
free(s);
}
}
@@
-168,17
+181,6
@@
static void path_dump(Unit *u, FILE *f, const char *prefix) {
s->path);
}
s->path);
}
-static void path_unwatch_one(Path *p, PathSpec *s) {
-
- if (s->inotify_fd < 0)
- return;
-
- unit_unwatch_fd(UNIT(p), &s->watch);
-
- close_nointr_nofail(s->inotify_fd);
- s->inotify_fd = -1;
-}
-
static int path_watch_one(Path *p, PathSpec *s) {
static const int flags_table[_PATH_TYPE_MAX] = {
[PATH_EXISTS] = IN_DELETE_SELF|IN_MOVE_SELF|IN_ATTRIB,
static int path_watch_one(Path *p, PathSpec *s) {
static const int flags_table[_PATH_TYPE_MAX] = {
[PATH_EXISTS] = IN_DELETE_SELF|IN_MOVE_SELF|IN_ATTRIB,