Re: XvQueryAdaptors: small memory leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Phil Dumont wrote:
Xv

SYNOPSIS:

There's a small memory leak in XvQueryAdaptors().

DESCRIPTION:

Not all of the memory allocated by XvQueryAdaptors is freed by
XvFreeAdaptorInfo.

It looks as though the culprit is the first Xalloc() in
XvQueryAdaptors().  The space is used as a local buffer (pointer
assigned to variable named "buffer") -- that is, the returned
XvAdaptorInfo structure does not have a reference to this memory, so
it is not XvFreeAdaptorInfo's responsibility to free it.  It must be
freed before returning from XvQueryAdaptors().

There are several failure paths where buffer is freed.  But on
success, it is not freed.

SAMPLE FIX:

Insert "Xfree(buffer);" immediately before the last return statement
of the XvQueryAdaptor().

I've tried this fix, and it seems ok.  The above sample program does
not work, and at least one Real Program (one that acutally uses the
returned data) seems to continue to work correctly.

This has been fixed 6 months ago in CVS.


p.s., from a cursory glance at XvQueryExtensions(), I'd say it has the
same problem, though I haven't tested it or tried to fix it.

There is no procedure named "XvQueryExtensions". And XvQueryExtension() (without s) looks perfectly ok to me.


What you probably mean is XvQueryEncodings(). If so, you're correct. It needs a similar fix as XvQueryAdaptor.

Thomas

--
Thomas Winischhofer
Vienna/Austria
thomas AT winischhofer DOT net          http://www.winischhofer.net/
twini AT xfree86 DOT org

_______________________________________________
XFree86 mailing list
XFree86@xxxxxxxxxxx
http://XFree86.Org/mailman/listinfo/xfree86

[Index of Archives]     [X Forum]     [Xorg]     [XFree86 Newbie]     [IETF Announce]     [Security]     [Font Config]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux Kernel]

  Powered by Linux