summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorAndreas Henriksson <andreas@fatal.se>2014-09-16 21:11:02 +0200
committerDaniel Mack <daniel@zonque.org>2014-09-16 21:47:24 +0200
commitaa9f8a30fd7dc7aa3aa2575b75b3f9a0ab3f02db (patch)
tree9b5964fd2e932a0cc83a1dc9c82758d6b89f7b9f /src/core
parent06b7f7bd7fa8cde840dd693c7a68dbd954c119ec (diff)
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
Diffstat (limited to 'src/core')
-rw-r--r--src/core/manager.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/core/manager.c b/src/core/manager.c
index 0770727cde..e0c1cd187e 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -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;
}