[PATCH xf86-video-vesa 3/4] Use VBEFreeVBEInfo not free

walter harms wharms at bfs.de
Wed Jan 31 15:57:35 UTC 2018



Am 31.01.2018 16:48, schrieb Adam Jackson:
> A VbeInfoBlock has substructure, just freeing the object will leak.
> Unfortunately VBEFreeVBEInfo does not check for NULL first so we have
> to.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=25029
> Signed-off-by: Adam Jackson <ajax at redhat.com>
> ---
>  src/vesa.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/vesa.c b/src/vesa.c
> index 3f5b81c..2d3c10d 100644
> --- a/src/vesa.c
> +++ b/src/vesa.c
> @@ -596,7 +596,8 @@ VESAFreeRec(ScrnInfoPtr pScrn)
>      }
>  #endif
>      free(pVesa->monitor);
> -    free(pVesa->vbeInfo);
> +    if (pVesa->vbeInfo)
> +	VBEFreeVBEInfo(pVesa->vbeInfo);

since all free function accept NULL these days it may be more efficient to
teach VBEFreeVBEInfo to accept NULL.

just my 2 cents,
re,
 wh

>      free(pVesa->pal);
>      free(pVesa->savedPal);
>      free(pVesa->fonts);


More information about the xorg-devel mailing list