sna: Free the handle after pwrite buffer allocation failure

Having just allocated the handle, we need to free it if we then fail to
allocate memory for the buffer.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2013-02-06 16:38:12 +00:00
parent 4b3b25f0be
commit be241fb25e
1 changed files with 2 additions and 1 deletions

View File

@ -5320,7 +5320,8 @@ struct kgem_bo *kgem_create_buffer(struct kgem *kgem,
old = &bo->base;
bo = buffer_alloc_with_data(num_pages(old));
if (bo == NULL) {
free(old);
old->refcnt= 0;
kgem_bo_free(kgem, old);
return NULL;
}