[SSSD] [PATCH] UTIL: Free log message when using journald

Simo Sorce simo at redhat.com
Mon Oct 21 14:35:34 UTC 2013


On Mon, 2013-10-21 at 11:01 +0200, Jakub Hrozek wrote:
> 
> I was exercising sssd with valgrind when looking for #1020945 and
> found
> this leak.
> 
> 
> 
> 
> 
> 
> 
> plain text
> document
> attachment
> (0001-UTIL-Free-log-message-when-using-journald.patch)
> 
> From 3bde2833eca1fc280214da03f067e3df63040899 Mon Sep 17 00:00:00 2001
> From: Jakub Hrozek <jhrozek at redhat.com>
> Date: Sun, 20 Oct 2013 16:52:06 +0200
> Subject: [PATCH 2/3] UTIL: Free log message when using journald
> 
> ---
>  src/util/sss_log.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/util/sss_log.c b/src/util/sss_log.c
> index
> 5be9e7f2bc1486d83393d2d105c1a73322d7f6f1..b6b922785b03f8d9673aebdeb33a83c3f6b14076 100644
> --- a/src/util/sss_log.c
> +++ b/src/util/sss_log.c
> @@ -88,6 +88,8 @@ void sss_log(int priority, const char *format, ...)
>                      "SYSLOG_FACILITY=%i", LOG_FAC(LOG_DAEMON),
>                      "SYSLOG_IDENTIFIER=%s", debug_prg_name,
>                      NULL);
> +
> +    free(message);
>  }
>  
>  #else /* WITH_JOURNALD */ 


Is there any reason why we are not using talloc_vasrpintf() here and
passing in a memcontext ?

I think I would rather fix this problem that way. 

Simo.

-- 
Simo Sorce * Red Hat, Inc * New York




More information about the sssd-devel mailing list