|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From 91e7bad45dced1cb2dfaac79337bb08d6e2b74a9 Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From: Andreas Henriksson <andreas@fatal.se>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Date: Tue, 16 Sep 2014 21:22:59 +0200
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Subject: [PATCH] sysv-generator: fix resource leak
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
The "unit" string allocation is not freed on either error or success path.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Found by coverity. Fixes: CID#1237755
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
src/sysv-generator/sysv-generator.c | 2 +-
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
index 6c3281ff15..e5902ab8f8 100644
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
--- a/src/sysv-generator/sysv-generator.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+++ b/src/sysv-generator/sysv-generator.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -114,9 +114,9 @@ static int add_symlink(const char *service, const char *where) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
static int generate_unit_file(SysvStub *s) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- char *unit;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
char **p;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
_cleanup_fclose_ FILE *f = NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ _cleanup_free_ char *unit = NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
_cleanup_free_ char *before = NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
_cleanup_free_ char *after = NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
_cleanup_free_ char *wants = NULL;
|