[PATCH:libX11 01/12] Fix file leak on malloc error in XlcDL.c:resolve_object()
Matthieu Herrb
matthieu.herrb at laas.fr
Sun Aug 11 02:34:12 PDT 2013
On Sat, Aug 10, 2013 at 01:54:58PM -0700, Alan Coopersmith wrote:
> File Leak: Leaked File fp
> at line 219 of lib/libX11/src/xlibi18n/XlcDL.c in function 'resolve_object'.
> fp initialized at line 198 with fopen
>
> [ This bug was found by the Parfait 1.2.0 bug checking tool.
> For more information see http://labs.oracle.com/projects/parfait/ ]
>
> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
Reviewed-by: Matthieu Herrb <matthieu.herrb at laas.fr>
> ---
> src/xlibi18n/XlcDL.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/xlibi18n/XlcDL.c b/src/xlibi18n/XlcDL.c
> index 75e193c..79e8a2f 100644
> --- a/src/xlibi18n/XlcDL.c
> +++ b/src/xlibi18n/XlcDL.c
> @@ -216,7 +216,8 @@ Limit the length of path to prevent stack buffer corruption.
> xi18n_objects_list = (XI18NObjectsList)
> Xrealloc(xi18n_objects_list,
> sizeof(XI18NObjectsListRec) * lc_len);
> - if (!xi18n_objects_list) return;
> + if (!xi18n_objects_list)
> + goto done;
> }
> n = parse_line(p, args, 6);
>
> @@ -244,6 +245,7 @@ Limit the length of path to prevent stack buffer corruption.
> lc_count++;
> }
> }
> + done:
> fclose(fp);
> }
>
> --
> 1.7.9.2
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
--
Matthieu Herrb
More information about the xorg-devel
mailing list