[Mesa-dev] [PATCH 2/2] clover: Destory pipe_screen when device does not support compute

2014-05-08 Thread Tom Stellard
---
 src/gallium/state_trackers/clover/core/device.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/clover/core/device.cpp 
b/src/gallium/state_trackers/clover/core/device.cpp
index 2f84677..70b5caf 100644
--- a/src/gallium/state_trackers/clover/core/device.cpp
+++ b/src/gallium/state_trackers/clover/core/device.cpp
@@ -42,8 +42,10 @@ 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)) {
+  pipe-destroy(pipe);
   throw error(CL_INVALID_DEVICE);
+   }
 }
 
 device::~device() {
-- 
1.8.1.5

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] clover: Destory pipe_screen when device does not support compute

2014-05-08 Thread Emil Velikov
On 09/05/14 02:17, Tom Stellard wrote:
 ---
  src/gallium/state_trackers/clover/core/device.cpp | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
 
 diff --git a/src/gallium/state_trackers/clover/core/device.cpp 
 b/src/gallium/state_trackers/clover/core/device.cpp
 index 2f84677..70b5caf 100644
 --- a/src/gallium/state_trackers/clover/core/device.cpp
 +++ b/src/gallium/state_trackers/clover/core/device.cpp
 @@ -42,8 +42,10 @@ 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)) {
 +  pipe-destroy(pipe);
throw error(CL_INVALID_DEVICE);
 +   }
  }
  
Hi Tom,

AFAICS this will crash when we fail to create the pipe_screen(pipe is NULL).

-Emil
  device::~device() {
 

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/2] clover: Destory pipe_screen when device does not support compute

2014-05-08 Thread Tom Stellard
---
 src/gallium/state_trackers/clover/core/device.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/clover/core/device.cpp 
b/src/gallium/state_trackers/clover/core/device.cpp
index 2f84677..70b5caf 100644
--- a/src/gallium/state_trackers/clover/core/device.cpp
+++ b/src/gallium/state_trackers/clover/core/device.cpp
@@ -42,8 +42,10 @@ 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)) {
+  pipe-destroy(pipe);
   throw error(CL_INVALID_DEVICE);
+   }
 }
 
 device::~device() {
-- 
1.8.1.5

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev