[systemd-devel] [PATCH] sysv-generator: fix resource leak
Daniel Mack
daniel at zonque.org
Tue Sep 16 12:52:40 PDT 2014
On 09/16/2014 09:22 PM, Andreas Henriksson wrote:
> The "unit" string allocation is not freed on either error or success path.
>
> Found by coverity. Fixes: CID#1237755
> ---
> src/sysv-generator/sysv-generator.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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;
>
Applied, thanks!
More information about the systemd-devel
mailing list