clover: Destory pipe_screen when device does not support compute v2
authorTom Stellard <thomas.stellard@amd.com>
Fri, 9 May 2014 01:08:32 +0000 (21:08 -0400)
committerTom Stellard <thomas.stellard@amd.com>
Fri, 9 May 2014 08:33:03 +0000 (04:33 -0400)
v2:
  - Make sure screen was successfully created before destroying it.

Cc: "10.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
src/gallium/state_trackers/clover/core/device.cpp

index 2f84677..bc3e3e6 100644 (file)
@@ -42,8 +42,11 @@ namespace {
 device::device(clover::platform &platform, pipe_loader_device *ldev) :
    platform(platform), ldev(ldev) {
    pipe = pipe_loader_create_screen(ldev, PIPE_SEARCH_DIR);
-   if (!pipe || !pipe->get_param(pipe, PIPE_CAP_COMPUTE))
+   if (!pipe || !pipe->get_param(pipe, PIPE_CAP_COMPUTE)) {
+      if (pipe)
+         pipe->destroy(pipe);
       throw error(CL_INVALID_DEVICE);
+   }
 }
 
 device::~device() {