[PATCH 09/10] xkb: fix memory leak in XkbDDXListComponent
Peter Hutterer
peter.hutterer at who-t.net
Tue Mar 29 14:22:40 PDT 2011
On Tue, Mar 29, 2011 at 06:12:35PM +0300, Tiago Vignatti wrote:
> Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
> ---
> xkb/ddxList.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/xkb/ddxList.c b/xkb/ddxList.c
> index 9623cb6..3d301d8 100644
> --- a/xkb/ddxList.c
> +++ b/xkb/ddxList.c
> @@ -222,8 +222,10 @@ char tmpname[PATH_MAX];
> list->nFound[what]= 0;
> free(buf);
> buf = malloc(PATH_MAX * sizeof(char));
> - if (!buf)
> + if (!buf) {
> + fclose(in);
> return BadAlloc;
> + }
> while ((status==Success)&&((tmp=fgets(buf,PATH_MAX,in))!=NULL)) {
> unsigned flags;
> register unsigned int i;
> --
> 1.7.0.4
usually referred to as file descriptor leak but
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
Cheers,
Peter
More information about the xorg-devel
mailing list