gallium: Check for OOM condition when creating a sampler view.
[mesa.git] / src / gallium / drivers / cell / ppu / cell_pipe_state.c
index 2fc82933e4d49ec30e9f41f5de0661e75d6aa09e..059ce8597bcf9883fd4a26564d803a4b1d81eb9e 100644 (file)
@@ -298,11 +298,13 @@ cell_create_sampler_view(struct pipe_context *pipe,
 {
    struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view);
 
-   *view = *templ;
-   view->reference.count = 1;
-   view->texture = NULL;
-   pipe_texture_reference(&view->texture, texture);
-   view->context = pipe;
+   if (view) {
+      *view = *templ;
+      view->reference.count = 1;
+      view->texture = NULL;
+      pipe_texture_reference(&view->texture, texture);
+      view->context = pipe;
+   }
 
    return view;
 }