diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-09-08 18:43:11 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-09-09 08:19:27 +0200 |
commit | a1e58e8ee1c84b633d6d6d651d5328d4dd4eba5b (patch) | |
tree | 2c5288c0e505c561c779ea13b4d99e8101803ca2 /src/core/swap.c | |
parent | da323858ef34a0216aa96f4089810053c90f09ce (diff) |
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.
Diffstat (limited to 'src/core/swap.c')
-rw-r--r-- | src/core/swap.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/core/swap.c b/src/core/swap.c index 2f462e339d..a26bc58cfc 100644 --- a/src/core/swap.c +++ b/src/core/swap.c @@ -59,8 +59,7 @@ static void swap_unset_proc_swaps(Swap *s) { if (!s->from_proc_swaps) return; - free(s->parameters_proc_swaps.what); - s->parameters_proc_swaps.what = NULL; + s->parameters_proc_swaps.what = mfree(s->parameters_proc_swaps.what); s->from_proc_swaps = false; } @@ -87,8 +86,7 @@ static int swap_set_devnode(Swap *s, const char *devnode) { else hashmap_remove(swaps, s->devnode); - free(s->devnode); - s->devnode = NULL; + s->devnode = mfree(s->devnode); } if (devnode) { @@ -141,14 +139,9 @@ static void swap_done(Unit *u) { swap_unset_proc_swaps(s); swap_set_devnode(s, NULL); - free(s->what); - s->what = NULL; - - free(s->parameters_fragment.what); - s->parameters_fragment.what = NULL; - - free(s->parameters_fragment.options); - s->parameters_fragment.options = NULL; + s->what = mfree(s->what); + s->parameters_fragment.what = mfree(s->parameters_fragment.what); + s->parameters_fragment.options = mfree(s->parameters_fragment.options); s->exec_runtime = exec_runtime_unref(s->exec_runtime); exec_command_done_array(s->exec_command, _SWAP_EXEC_COMMAND_MAX); |