mirror of
https://github.com/morgan9e/systemd
synced 2026-04-15 17:06:39 +09:00
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:
committed by
Daniel Mack
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user