[systemd-commits] 3 commits - src/core src/shared src/sysv-generator
Daniel Mack
zonque at kemper.freedesktop.org
Tue Sep 16 12:52:10 PDT 2014
src/core/manager.c | 4 +++-
src/shared/install.c | 4 +++-
src/sysv-generator/sysv-generator.c | 2 +-
3 files changed, 7 insertions(+), 3 deletions(-)
New commits:
commit d9ab174bd7ec1dd5b382d3d84737d1c9ed1f4481
Author: Andreas Henriksson <andreas at fatal.se>
Date: Tue Sep 16 21:36:26 2014 +0200
shared: fix resource leak in config_parse_default_instance
The recently allocated "printed" is not freed on error path.
Found by coverity. Fixes: CID#1237745
diff --git a/src/shared/install.c b/src/shared/install.c
index 5d3fcf5..61e572b 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -1025,8 +1025,10 @@ static int config_parse_default_instance(
if (r < 0)
return r;
- if (!unit_instance_is_valid(printed))
+ if (!unit_instance_is_valid(printed)) {
+ free(printed);
return -EINVAL;
+ }
free(i->default_instance);
i->default_instance = printed;
commit 91e7bad45dced1cb2dfaac79337bb08d6e2b74a9
Author: Andreas Henriksson <andreas at fatal.se>
Date: Tue Sep 16 21:22:59 2014 +0200
sysv-generator: fix resource leak
The "unit" string allocation is not freed on either error or success path.
Found by coverity. Fixes: CID#1237755
diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
index 6c3281f..e5902ab 100644
--- a/src/sysv-generator/sysv-generator.c
+++ b/src/sysv-generator/sysv-generator.c
@@ -114,9 +114,9 @@ static int add_symlink(const char *service, const char *where) {
}
static int generate_unit_file(SysvStub *s) {
- char *unit;
char **p;
_cleanup_fclose_ FILE *f = NULL;
+ _cleanup_free_ char *unit = NULL;
_cleanup_free_ char *before = NULL;
_cleanup_free_ char *after = NULL;
_cleanup_free_ char *wants = NULL;
commit aa9f8a30fd7dc7aa3aa2575b75b3f9a0ab3f02db
Author: Andreas Henriksson <andreas at fatal.se>
Date: Tue Sep 16 21:11:02 2014 +0200
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
diff --git a/src/core/manager.c b/src/core/manager.c
index 0770727..e0c1cd1 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;
}
More information about the systemd-commits
mailing list