[PATCH libSM] Fix some potential memory leaks in SmcCloseConnection().

Kim Woelders kim at woelders.dk
Tue Nov 9 10:14:24 PST 2010


Ping?

These memory leaks are probably not a problem in the real world as they  
have been there at least since the start of git history, but isn't it  
still worth while to silence some "definitely lost" valgrind complaints?

/Kim


On Sat, 30 Oct 2010 10:51:00 +0200, Kim Woelders <kim at woelders.dk> wrote:
>
> Signed-off-by: Kim Woelders <kim at woelders.dk>
>
> diff --git a/src/sm_client.c b/src/sm_client.c
> index a5c714f..5454398 100644
> --- a/src/sm_client.c
> +++ b/src/sm_client.c
> @@ -325,6 +325,22 @@ SmcCloseConnection(SmcConn smcConn, int count, char  
> **reasonMsgs)
>      if (smcConn->client_id)
>  	free (smcConn->client_id);
>
> +    if (smcConn->interact_waits)
> +    {
> +	_SmcInteractWait *ptr = smcConn->interact_waits;
> +	_SmcInteractWait *next;
> +
> +	while (ptr)
> +	{
> +	    next = ptr->next;
> +	    free ((char *) ptr);
> +	    ptr = next;
> +	}
> +    }
> +
> +    if (smcConn->phase2_wait)
> +	free (smcConn->phase2_wait);
> +
>      if (smcConn->prop_reply_waits)
>      {
>  	_SmcPropReplyWait *ptr = smcConn->prop_reply_waits;


More information about the xorg-devel mailing list