]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/core/execute.c
tree-wide: use coccinelle to patch a lot of code to use mfree()
[thirdparty/systemd.git] / src / core / execute.c
index 28eeeaad182f912f24b1d5007024190cb3cceaf5..de5c16bd766731d92a0ce714c30774c9b09fe606 100644 (file)
@@ -1994,32 +1994,20 @@ void exec_context_done(ExecContext *c) {
         c->environment_files = NULL;
 
         for (l = 0; l < ELEMENTSOF(c->rlimit); l++) {
-                free(c->rlimit[l]);
-                c->rlimit[l] = NULL;
+                c->rlimit[l] = mfree(c->rlimit[l]);
         }
 
-        free(c->working_directory);
-        c->working_directory = NULL;
-        free(c->root_directory);
-        c->root_directory = NULL;
-
-        free(c->tty_path);
-        c->tty_path = NULL;
-
-        free(c->syslog_identifier);
-        c->syslog_identifier = NULL;
-
-        free(c->user);
-        c->user = NULL;
-
-        free(c->group);
-        c->group = NULL;
+        c->working_directory = mfree(c->working_directory);
+        c->root_directory = mfree(c->root_directory);
+        c->tty_path = mfree(c->tty_path);
+        c->syslog_identifier = mfree(c->syslog_identifier);
+        c->user = mfree(c->user);
+        c->group = mfree(c->group);
 
         strv_free(c->supplementary_groups);
         c->supplementary_groups = NULL;
 
-        free(c->pam_name);
-        c->pam_name = NULL;
+        c->pam_name = mfree(c->pam_name);
 
         if (c->capabilities) {
                 cap_free(c->capabilities);
@@ -2038,14 +2026,9 @@ void exec_context_done(ExecContext *c) {
         if (c->cpuset)
                 CPU_FREE(c->cpuset);
 
-        free(c->utmp_id);
-        c->utmp_id = NULL;
-
-        free(c->selinux_context);
-        c->selinux_context = NULL;
-
-        free(c->apparmor_profile);
-        c->apparmor_profile = NULL;
+        c->utmp_id = mfree(c->utmp_id);
+        c->selinux_context = mfree(c->selinux_context);
+        c->apparmor_profile = mfree(c->apparmor_profile);
 
         set_free(c->syscall_filter);
         c->syscall_filter = NULL;
@@ -2090,8 +2073,7 @@ int exec_context_destroy_runtime_directory(ExecContext *c, const char *runtime_p
 void exec_command_done(ExecCommand *c) {
         assert(c);
 
-        free(c->path);
-        c->path = NULL;
+        c->path = mfree(c->path);
 
         strv_free(c->argv);
         c->argv = NULL;