vl: u_upload_alloc might fail to allocate buffer in bicubic filter
authorNayan Deshmukh <nayan26deshmukh@gmail.com>
Wed, 22 Feb 2017 08:25:02 +0000 (13:55 +0530)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 22 Feb 2017 20:49:19 +0000 (21:49 +0100)
Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/auxiliary/vl/vl_bicubic_filter.c

index ae292084283e6e0e1394717e2e448313a6f8bcb3..efd8a1c7aec6b38930b528b9d33cba005aefac52 100644 (file)
@@ -421,14 +421,16 @@ vl_bicubic_filter_render(struct vl_bicubic_filter *filter,
    viewport.scale[2] = 1;
 
    struct pipe_constant_buffer cb = {};
-   float *ptr;
+   float *ptr = NULL;
 
    u_upload_alloc(filter->pipe->const_uploader, 0, 2 * sizeof(float), 256,
                   &cb.buffer_offset, &cb.buffer, (void**)&ptr);
    cb.buffer_size = 2 * sizeof(float);
 
-   ptr[0] = 0.5f/viewport.scale[0];
-   ptr[1] = 0.5f/viewport.scale[1];
+   if (ptr) {
+      ptr[0] = 0.5f/viewport.scale[0];
+      ptr[1] = 0.5f/viewport.scale[1];
+   }
    u_upload_unmap(filter->pipe->const_uploader);
 
    memset(&fb_state, 0, sizeof(fb_state));