[PATCH] [xorg/xserver] mi/misprite: release private record

Daniel Stone daniel at fooishbar.org
Wed Mar 9 06:42:04 PST 2011


Hi,

On Wed, Mar 09, 2011 at 04:19:06PM +0200, Erkki Seppala wrote:
> On 09.03.2011 15:57, Daniel Stone wrote:
> >You could get this automatically by having miSpriteDevPrivatesKey
> >allocate sizeof(miCursorInfoRec), rather than doing the allocation and
> >free separately.
> 
> Thanks for the feedback!
> 
> I considered this with Rami, but it appeared that it uses the
> NULLness of the pointer for making a decision. In file misprite.c:
>
> [...]
> 
>             pCursorInfo = MISPRITE(pDev);
>             if (pCursorInfo && !pCursorInfo->isUp
>                     && pCursorInfo->pScreen == pScreen
>                     && pCursorInfo->shouldBeUp)
>             {
>                 [...]
>             }
> 
> So at least this code is prepared to handle the case that the
> privates are not allocated. Is this something that can never
> actually happen, and therefore one could just use the automated
> mechanism?
> 
> (I guess I should've mentioned this in the commit message already ;-).)

Heh.  Well, if you allocate space with the private key it comes
pre-calloced, so pCursorInfo->shouldBeUp will never be true, and
pCursorInfo->pScreen will never match.

Cheers,
Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg-devel/attachments/20110309/7d0a3ea7/attachment.pgp>


More information about the xorg-devel mailing list