sysv-generator: fix resource leak

The "unit" string allocation is not freed on either error or success path.

Found by coverity. Fixes: CID#1237755
This commit is contained in:
Andreas Henriksson
2014-09-16 21:49:03 +02:00
committed by Daniel Mack
parent aa9f8a30fd
commit 91e7bad45d
+1 -1
View File
@@ -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;