mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-04 15:40:11 +01:00
check for null ptr in xm_buffer_unreference()
This commit is contained in:
parent
440e794b05
commit
ac8249d0ed
1 changed files with 11 additions and 9 deletions
|
|
@ -112,17 +112,19 @@ xm_buffer_reference(struct pipe_winsys *pws, struct pipe_buffer_handle *buf)
|
|||
static void
|
||||
xm_buffer_unreference(struct pipe_winsys *pws, struct pipe_buffer_handle **buf)
|
||||
{
|
||||
struct xm_buffer *xm_buf = xm_bo(*buf);
|
||||
xm_buf->refcount--;
|
||||
assert(xm_buf->refcount >= 0);
|
||||
if (xm_buf->refcount == 0) {
|
||||
if (xm_buf->data) {
|
||||
free(xm_buf->data);
|
||||
xm_buf->data = NULL;
|
||||
if (*buf) {
|
||||
struct xm_buffer *xm_buf = xm_bo(*buf);
|
||||
xm_buf->refcount--;
|
||||
assert(xm_buf->refcount >= 0);
|
||||
if (xm_buf->refcount == 0) {
|
||||
if (xm_buf->data) {
|
||||
free(xm_buf->data);
|
||||
xm_buf->data = NULL;
|
||||
}
|
||||
free(xm_buf);
|
||||
}
|
||||
free(xm_buf);
|
||||
*buf = NULL;
|
||||
}
|
||||
*buf = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue