core/execute: set_get_strv() does not transfer ownership of strings

Prompted by #37090
This commit is contained in:
Mike Yuan
2025-04-13 09:14:18 +09:00
committed by Yu Watanabe
parent 5935d74613
commit 7065494e7e
2 changed files with 5 additions and 7 deletions
+1 -1
View File
@@ -440,7 +440,7 @@ static int property_get_restrict_filesystems(
sd_bus_error *error) {
ExecContext *c = ASSERT_PTR(userdata);
_cleanup_free_ char **l = NULL;
_cleanup_free_ char **l = NULL; /* Strings are owned by 'c->restrict_filesystems'! */
int r;
assert(bus);
+4 -6
View File
@@ -1979,19 +1979,17 @@ char** exec_context_get_address_families(const ExecContext *c) {
}
char** exec_context_get_restrict_filesystems(const ExecContext *c) {
_cleanup_strv_free_ char **l = NULL;
assert(c);
#if HAVE_LIBBPF
l = set_get_strv(c->restrict_filesystems);
char **l = set_get_strv(c->restrict_filesystems);
if (!l)
return NULL;
strv_sort(l);
return strv_sort(l);
#else
return strv_new(NULL);
#endif
return l ? TAKE_PTR(l) : strv_new(NULL);
}
void exec_status_start(ExecStatus *s, pid_t pid, const dual_timestamp *ts) {