xfree86: dri2: fix memory leak and free resources properly
Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com> Reviewed-by: Nicolas Peninguy <nico@lostgeeks.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
aa7096ca6f
commit
8ab92cd982
|
@ -221,11 +221,16 @@ DRI2AddDrawableRef(DRI2DrawablePtr pPriv, XID id, XID dri2_id,
|
|||
if (ref == NULL)
|
||||
return BadAlloc;
|
||||
|
||||
if (!AddResource(dri2_id, dri2DrawableRes, pPriv))
|
||||
if (!AddResource(dri2_id, dri2DrawableRes, pPriv)) {
|
||||
free(ref);
|
||||
return BadAlloc;
|
||||
}
|
||||
if (!DRI2LookupDrawableRef(pPriv, id))
|
||||
if (!AddResource(id, dri2DrawableRes, pPriv))
|
||||
if (!AddResource(id, dri2DrawableRes, pPriv)) {
|
||||
FreeResourceByType(dri2_id, dri2DrawableRes, TRUE);
|
||||
free(ref);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
ref->id = id;
|
||||
ref->dri2_id = dri2_id;
|
||||
|
|
Loading…
Reference in New Issue
Block a user