tree-wide: use coccinelle to patch a lot of code to use mfree()

This replaces this:

        free(p);
        p = NULL;

by this:

        p = mfree(p);

Change generated using coccinelle. Semantic patch is added to the
sources.
This commit is contained in:
Lennart Poettering
2015-09-09 08:19:27 +02:00
parent da323858ef
commit a1e58e8ee1
42 changed files with 86 additions and 173 deletions
+12 -30
View 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;