Signed-off-by: Tiago Vignatti <[email protected]>
---
Same as the previous patch: I'm not exactly seeing any problem or segfault
with this code. I just got this issue with the static analyzer.
hw/xfree86/dri2/dri2.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index d4181c9..26f5ac4 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -207,10 +207,10 @@ DRI2AddDrawableRef(DRI2DrawablePtr pPriv, XID id, XID
dri2_id,
return BadAlloc;
if (!AddResource(dri2_id, dri2DrawableRes, pPriv))
- return BadAlloc;
+ goto err_out;
if (!DRI2LookupDrawableRef(pPriv, id))
if (!AddResource(id, dri2DrawableRes, pPriv))
- return BadAlloc;
+ goto err_out;
ref->id = id;
ref->dri2_id = dri2_id;
@@ -219,6 +219,10 @@ DRI2AddDrawableRef(DRI2DrawablePtr pPriv, XID id, XID
dri2_id,
list_add(&ref->link, &pPriv->reference_list);
return Success;
+
+err_out:
+ free(ref);
+ return BadAlloc;
}
int
--
1.7.1.226.g770c5
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel