diff options
Diffstat (limited to 'mesalib/src/glsl/ralloc.c')
-rw-r--r-- | mesalib/src/glsl/ralloc.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/mesalib/src/glsl/ralloc.c b/mesalib/src/glsl/ralloc.c index 59e71c48b..e79dad764 100644 --- a/mesalib/src/glsl/ralloc.c +++ b/mesalib/src/glsl/ralloc.c @@ -107,9 +107,13 @@ void * ralloc_size(const void *ctx, size_t size) { void *block = calloc(1, size + sizeof(ralloc_header)); + ralloc_header *info; + ralloc_header *parent; - ralloc_header *info = (ralloc_header *) block; - ralloc_header *parent = ctx != NULL ? get_header(ctx) : NULL; + if (unlikely(block == NULL)) + return NULL; + info = (ralloc_header *) block; + parent = ctx != NULL ? get_header(ctx) : NULL; add_child(parent, info); |