core: fix resource leak in manager_environment_add
Second error path must free the (potentially) allocated memory in the first code chunk before returning. Found by coverity. Fixes: CID#1237750
This commit is contained in:
parent
06b7f7bd7f
commit
aa9f8a30fd
|
@ -2751,8 +2751,10 @@ int manager_environment_add(Manager *m, char **minus, char **plus) {
|
|||
|
||||
if (!strv_isempty(plus)) {
|
||||
b = strv_env_merge(2, l, plus);
|
||||
if (!b)
|
||||
if (!b) {
|
||||
strv_free(a);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
l = b;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue