summaryrefslogtreecommitdiff
path: root/execute.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-04-10 17:47:07 +0200
committerLennart Poettering <lennart@poettering.net>2010-04-10 18:00:34 +0200
commit43d0fcbd3f54a5f3c5636acf9b54f19a07de7a18 (patch)
treea55586f842ab4bd3626af827c744112728660e26 /execute.c
parent26fd040d4a8024f1777154c275796e235a0f7451 (diff)
execute: introduce exec_command_done() to free data from static ExecCommand structs
Diffstat (limited to 'execute.c')
-rw-r--r--execute.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/execute.c b/execute.c
index 6cf6615da4..3d2e511333 100644
--- a/execute.c
+++ b/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) {
ExecCommand *i;
while ((i = c)) {
LIST_REMOVE(ExecCommand, command, c, i);
-
- free(i->path);
- strv_free(i->argv);
+ exec_command_done(i);
free(i);
}
}