diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2010-06-30 13:58:05 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2010-06-30 13:58:05 +0100 |
commit | 772f8236d50725f0b330508616b4f2a9a910662a (patch) | |
tree | db3ac5228853ec8ec62699f3f6ac9917c4286bf1 | |
parent | 17884af4eda01c05e7429ed6a195f3e4ceeff892 (diff) |
dri: Handle errors during GetBuffers() gracefully.
Unwind the array of Pixmaps already allocated and report failure for the
old dri GetBuffers() path.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/intel_dri.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/intel_dri.c b/src/intel_dri.c index e876ab23..198d5d48 100644 --- a/src/intel_dri.c +++ b/src/intel_dri.c @@ -147,12 +147,21 @@ I830DRI2CreateBuffers(DrawablePtr drawable, unsigned int *attachments, privates[i].attachment = attachments[i]; bo = intel_get_pixmap_bo(pixmap); - if (bo != NULL && dri_bo_flink(bo, &buffers[i].name) != 0) { + if (bo == NULL || dri_bo_flink(bo, &buffers[i].name) != 0) { /* failed to name buffer */ + screen->DestroyPixmap(pixmap); + goto unwind; } } return buffers; + +unwind: + while (i--) + screen->DestroyPixmap(privates[i].pixmap); + free(privates); + free(buffers); + return NULL; } static void |