diff options
| author | Daniel Golle | 2020-01-19 07:42:37 +0000 |
|---|---|---|
| committer | Daniel Golle | 2020-01-19 07:43:58 +0000 |
| commit | 0a11aa405d3fbe970458d1cc154970e817826616 (patch) | |
| tree | e0d59297c780a5f6a87e835b354750e9e2907f1b | |
| parent | 44dd9419812b6dc8fa164833fb274e33e5e284fa (diff) | |
| download | procd-0a11aa405d3fbe970458d1cc154970e817826616.tar.gz | |
instance: Fix instance_config_move_strdup() function
instance_config_move_strdup() previously returned too early in case of
a value being previously unassigned.
Fixes: 153820c ("instance: fix pidfile and seccomp attributes double free")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
| -rw-r--r-- | service/instance.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/service/instance.c b/service/instance.c index ee25868..14da862 100644 --- a/service/instance.c +++ b/service/instance.c @@ -1021,11 +1021,10 @@ instance_config_cleanup(struct service_instance *in) static void instance_config_move_strdup(char **dst, char *src) { - if (!*dst) - return; - - free(*dst); - *dst = NULL; + if (*dst) { + free(*dst); + *dst = NULL; + } if (!src) return; |