summaryrefslogtreecommitdiff
path: root/src/shared/install.c
diff options
context:
space:
mode:
authorAndreas Henriksson <andreas@fatal.se>2014-09-16 21:36:26 +0200
committerDaniel Mack <daniel@zonque.org>2014-09-16 21:49:56 +0200
commitd9ab174bd7ec1dd5b382d3d84737d1c9ed1f4481 (patch)
tree204d6f45678ba87037f456d1c63270126cabbe15 /src/shared/install.c
parent91e7bad45dced1cb2dfaac79337bb08d6e2b74a9 (diff)
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
Diffstat (limited to 'src/shared/install.c')
-rw-r--r--src/shared/install.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/shared/install.c b/src/shared/install.c
index 5d3fcf5e32..61e572bdf3 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;