summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/bus-objects.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsystemd-bus/bus-objects.c')
-rw-r--r--src/libsystemd-bus/bus-objects.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/libsystemd-bus/bus-objects.c b/src/libsystemd-bus/bus-objects.c
index 92781e9adc..93bd3ad86c 100644
--- a/src/libsystemd-bus/bus-objects.c
+++ b/src/libsystemd-bus/bus-objects.c
@@ -114,12 +114,17 @@ static int add_enumerated_to_set(
continue;
}
- if (!object_path_is_valid(*k) && object_path_startswith(*k, prefix)) {
+ if (!object_path_is_valid(*k)){
free(*k);
r = -EINVAL;
continue;
}
+ if (!object_path_startswith(*k, prefix)) {
+ free(*k);
+ continue;
+ }
+
r = set_consume(s, *k);
}
@@ -154,6 +159,9 @@ static int add_subtree_to_set(
LIST_FOREACH(siblings, i, n->child) {
char *t;
+ if (!object_path_startswith(i->path, prefix))
+ continue;
+
t = strdup(i->path);
if (!t)
return -ENOMEM;