mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
gallium: Use CALLOC for pb_buffer to ensure that all fields of pipe_buffer are initiallized.
This commit is contained in:
parent
f3d0882c02
commit
93d727eea7
3 changed files with 4 additions and 3 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue