On Wed, 2016-02-03 at 09:54 +0000, Chris Wilson wrote:
> @@ -203,6 +203,11 @@ DRI2AllocateDrawable(DrawablePtr pDraw)
> if (pPriv == NULL)
> return NULL;
>
> + if (!AddResource(pDraw->id, dri2DrawableRes, pPriv)) {
> + free(pPriv);
> + return NULL;
> + }
> +
> pPriv->dri2_screen = ds;
> pPriv->drawable = pDraw;
> pPriv->width = pDraw->width;
Newp. If AddResource fails it'll call DRI2DrawableGone for you, which
means in the absolute best case you'd double-free. Since you haven't
initialized any of pPriv at this point hell knows precisely what will
explode, but it'll be something.
> ref = malloc(sizeof *ref);
> if (ref == NULL)
> return BadAlloc;
>
> - if (!AddResource(dri2_id, dri2DrawableRes, pPriv)) {
> + if (!AddResource(pid, dri2ReferenceRes, ref)) {
> free(ref);
> return BadAlloc;
> }
Same deal here, although here you're forgiven for the double-free since
it was already there.
- ajax
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel