[PATCH libX11 1/2] Fix potential memory leak
Alan Coopersmith
alan.coopersmith at oracle.com
Mon May 18 15:30:35 PDT 2015
On 05/17/15 03:54 PM, Peter Hutterer wrote:
> If we hit the depth limit, filename leaks. Move the depth check up before we
> allocate filename.
> Introduced in 226622349a4b1e16064649d4444a34fb4be4f464.
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
> modules/im/ximcp/imLcPrs.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/modules/im/ximcp/imLcPrs.c b/modules/im/ximcp/imLcPrs.c
> index 9bb45ff..4979975 100644
> --- a/modules/im/ximcp/imLcPrs.c
> +++ b/modules/im/ximcp/imLcPrs.c
> @@ -496,10 +496,10 @@ parseline(
> token = nexttoken(fp, tokenbuf, &lastch);
> if (token != KEY && token != STRING)
> goto error;
> - if ((filename = TransFileName(im, tokenbuf)) == NULL)
> - goto error;
> if (++depth > 100)
> goto error;
> + if ((filename = TransFileName(im, tokenbuf)) == NULL)
> + goto error;
> infp = _XFopenFile(filename, "r");
> Xfree(filename);
> if (infp == NULL)
>
For both patches,
Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
Thanks,
--
-Alan Coopersmith- alan.coopersmith at oracle.com
Oracle Solaris Engineering - http://blogs.oracle.com/alanc
More information about the xorg-devel
mailing list