diff options
author | José Fonseca <[email protected]> | 2008-01-29 09:41:21 +0900 |
---|---|---|
committer | José Fonseca <[email protected]> | 2008-01-29 09:41:21 +0900 |
commit | 93d727eea75812ecb21706804033a33d2e761eb8 (patch) | |
tree | 48eb4f38c5939461022ffee477072f29754702e8 /src/mesa/pipe/pipebuffer | |
parent | f3d0882c0218612a91a6feac91d23b34f6447d8e (diff) |
gallium: Use CALLOC for pb_buffer to ensure that all fields of pipe_buffer are initiallized.
Diffstat (limited to 'src/mesa/pipe/pipebuffer')
-rw-r--r-- | src/mesa/pipe/pipebuffer/pb_buffer_malloc.c | 3 | ||||
-rw-r--r-- | src/mesa/pipe/pipebuffer/pb_bufmgr_mm.c | 2 | ||||
-rw-r--r-- | src/mesa/pipe/pipebuffer/pb_bufmgr_pool.c | 2 |
3 files changed, 4 insertions, 3 deletions
diff --git a/src/mesa/pipe/pipebuffer/pb_buffer_malloc.c b/src/mesa/pipe/pipebuffer/pb_buffer_malloc.c index fc83a00f367..2151f1d691e 100644 --- a/src/mesa/pipe/pipebuffer/pb_buffer_malloc.c +++ b/src/mesa/pipe/pipebuffer/pb_buffer_malloc.c @@ -107,10 +107,9 @@ pb_malloc_buffer_create(size_t size, { struct malloc_buffer *buf; - /* TODO: accept an alignment parameter */ /* TODO: do a single allocation */ - buf = (struct malloc_buffer *)MALLOC(sizeof(struct malloc_buffer)); + buf = CALLOC_STRUCT(malloc_buffer); if(!buf) return NULL; diff --git a/src/mesa/pipe/pipebuffer/pb_bufmgr_mm.c b/src/mesa/pipe/pipebuffer/pb_bufmgr_mm.c index 2694f57bca0..a2657dac592 100644 --- a/src/mesa/pipe/pipebuffer/pb_bufmgr_mm.c +++ b/src/mesa/pipe/pipebuffer/pb_bufmgr_mm.c @@ -399,6 +399,8 @@ mm_buffer_destroy(struct pb_buffer *buf) struct mm_buffer *mm_buf = mm_buffer(buf); struct mm_pb_manager *mm = mm_buf->mgr; + assert(buf->base.refcount == 0); + _glthread_LOCK_MUTEX(mm->mutex); mmFreeMem(mm_buf->block); FREE(buf); diff --git a/src/mesa/pipe/pipebuffer/pb_bufmgr_pool.c b/src/mesa/pipe/pipebuffer/pb_bufmgr_pool.c index 7c299541122..f80c7e34c07 100644 --- a/src/mesa/pipe/pipebuffer/pb_bufmgr_pool.c +++ b/src/mesa/pipe/pipebuffer/pb_bufmgr_pool.c @@ -258,7 +258,7 @@ pool_bufmgr_create(struct pb_manager *provider, if(!pool->map) goto failure; - pool->bufs = (struct pool_buffer *) MALLOC(numBufs * sizeof(*pool->bufs)); + pool->bufs = (struct pool_buffer *)CALLOC(numBufs, sizeof(*pool->bufs)); if (!pool->bufs) goto failure; |