mirror of
https://github.com/systemd/systemd.git
synced 2024-11-05 06:52:22 +03:00
execute: introduce exec_command_done() to free data from static ExecCommand structs
This commit is contained in:
parent
26fd040d4a
commit
43d0fcbd3f
21
execute.c
21
execute.c
@ -776,14 +776,29 @@ void exec_context_done(ExecContext *c) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void exec_command_done(ExecCommand *c) {
|
||||||
|
assert(c);
|
||||||
|
|
||||||
|
free(c->path);
|
||||||
|
c->path = NULL;
|
||||||
|
|
||||||
|
strv_free(c->argv);
|
||||||
|
c->argv = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void exec_command_done_array(ExecCommand *c, unsigned n) {
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
for (i = 0; i < n; i++)
|
||||||
|
exec_command_done(c+i);
|
||||||
|
}
|
||||||
|
|
||||||
void exec_command_free_list(ExecCommand *c) {
|
void exec_command_free_list(ExecCommand *c) {
|
||||||
ExecCommand *i;
|
ExecCommand *i;
|
||||||
|
|
||||||
while ((i = c)) {
|
while ((i = c)) {
|
||||||
LIST_REMOVE(ExecCommand, command, c, i);
|
LIST_REMOVE(ExecCommand, command, c, i);
|
||||||
|
exec_command_done(i);
|
||||||
free(i->path);
|
|
||||||
strv_free(i->argv);
|
|
||||||
free(i);
|
free(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -162,6 +162,9 @@ int exec_spawn(ExecCommand *command,
|
|||||||
struct CGroupBonding *cgroup_bondings,
|
struct CGroupBonding *cgroup_bondings,
|
||||||
pid_t *ret);
|
pid_t *ret);
|
||||||
|
|
||||||
|
void exec_command_done(ExecCommand *c);
|
||||||
|
void exec_command_done_array(ExecCommand *c, unsigned n);
|
||||||
|
|
||||||
void exec_command_free_list(ExecCommand *c);
|
void exec_command_free_list(ExecCommand *c);
|
||||||
void exec_command_free_array(ExecCommand **c, unsigned n);
|
void exec_command_free_array(ExecCommand **c, unsigned n);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user