core/execute: set_get_strv() does not transfer ownership of strings
Prompted by #37090
This commit is contained in:
@@ -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
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user