summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2017-07-21 14:42:06 +0200
committerSamuel Pitoiset <[email protected]>2017-07-24 16:43:38 +0200
commit986f9e50ded299802fc0ad63e5643f6df62c31ec (patch)
tree6765a882de7b5ddf351d2a52a20286034b7cab7b
parentb2448468213e5157d1d12545d049b02104f4edc2 (diff)
mesa: return GL_OUT_OF_MEMORY if NewSamplerObject fails
This is similar to other functions that create objects. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
-rw-r--r--src/mesa/main/samplerobj.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c
index 326eceb1aa2..74464410862 100644
--- a/src/mesa/main/samplerobj.c
+++ b/src/mesa/main/samplerobj.c
@@ -169,10 +169,18 @@ create_samplers(struct gl_context *ctx, GLsizei count, GLuint *samplers,
/* Insert the ID and pointer to new sampler object into hash table */
for (i = 0; i < count; i++) {
- struct gl_sampler_object *sampObj =
- ctx->Driver.NewSamplerObject(ctx, first + i);
- _mesa_HashInsertLocked(ctx->Shared->SamplerObjects, first + i, sampObj);
- samplers[i] = first + i;
+ struct gl_sampler_object *sampObj;
+ GLuint name = first + i;
+
+ sampObj = ctx->Driver.NewSamplerObject(ctx, name);
+ if (!sampObj) {
+ _mesa_HashUnlockMutex(ctx->Shared->SamplerObjects);
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", caller);
+ return;
+ }
+
+ _mesa_HashInsertLocked(ctx->Shared->SamplerObjects, name, sampObj);
+ samplers[i] = name;
}
_mesa_HashUnlockMutex(ctx->Shared->SamplerObjects);