aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/vbo/vbo_rebase.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-05-11 17:43:25 +0200
committermarha <marha@users.sourceforge.net>2014-05-11 17:43:25 +0200
commit26dfcdba6c306d6312c598e4191449302329be68 (patch)
tree2bf56b5a0eb2cc554833fdc6e08f2b59f1bfdabd /mesalib/src/mesa/vbo/vbo_rebase.c
parent2dc2880eacae3d52f4ab4bb5ec43c5bbf50c5c3f (diff)
parentae06feae7876db47ff0e1fde40cf4a324a412037 (diff)
downloadvcxsrv-26dfcdba6c306d6312c598e4191449302329be68.tar.gz
vcxsrv-26dfcdba6c306d6312c598e4191449302329be68.tar.bz2
vcxsrv-26dfcdba6c306d6312c598e4191449302329be68.zip
Merge remote-tracking branch 'origin/released'
Conflicts: mesalib/src/mesa/main/imports.h
Diffstat (limited to 'mesalib/src/mesa/vbo/vbo_rebase.c')
-rw-r--r--mesalib/src/mesa/vbo/vbo_rebase.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/mesalib/src/mesa/vbo/vbo_rebase.c b/mesalib/src/mesa/vbo/vbo_rebase.c
index f3fe5f757..82a0b8e2b 100644
--- a/mesalib/src/mesa/vbo/vbo_rebase.c
+++ b/mesalib/src/mesa/vbo/vbo_rebase.c
@@ -58,9 +58,14 @@ static void *rebase_##TYPE( const void *ptr, \
GLuint count, \
TYPE min_index ) \
{ \
- const TYPE *in = (TYPE *)ptr; \
- TYPE *tmp_indices = malloc(count * sizeof(TYPE)); \
GLuint i; \
+ const TYPE *in = (TYPE *)ptr; \
+ TYPE *tmp_indices = malloc(count * sizeof(TYPE)); \
+ \
+ if (tmp_indices == NULL) { \
+ _mesa_error_no_memory(__func__); \
+ return NULL; \
+ } \
\
for (i = 0; i < count; i++) \
tmp_indices[i] = in[i] - min_index; \
@@ -148,6 +153,11 @@ void vbo_rebase_prims( struct gl_context *ctx,
*/
tmp_prims = malloc(sizeof(*prim) * nr_prims);
+ if (tmp_prims == NULL) {
+ _mesa_error_no_memory(__func__);
+ return;
+ }
+
for (i = 0; i < nr_prims; i++) {
tmp_prims[i] = prim[i];
tmp_prims[i].basevertex -= min_index;
@@ -186,6 +196,10 @@ void vbo_rebase_prims( struct gl_context *ctx,
if (map_ib)
ctx->Driver.UnmapBuffer(ctx, ib->obj, MAP_INTERNAL);
+ if (tmp_indices == NULL) {
+ return;
+ }
+
tmp_ib.obj = ctx->Shared->NullBufferObj;
tmp_ib.ptr = tmp_indices;
tmp_ib.count = ib->count;
@@ -198,6 +212,11 @@ void vbo_rebase_prims( struct gl_context *ctx,
*/
tmp_prims = malloc(sizeof(*prim) * nr_prims);
+ if (tmp_prims == NULL) {
+ _mesa_error_no_memory(__func__);
+ return;
+ }
+
for (i = 0; i < nr_prims; i++) {
/* If this fails, it could indicate an application error:
*/