clover: Fix memory leak when initializing a device object fails.
authorFrancisco Jerez <currojerez@riseup.net>
Thu, 19 Sep 2013 03:57:39 +0000 (20:57 -0700)
committerFrancisco Jerez <currojerez@riseup.net>
Mon, 21 Oct 2013 17:47:03 +0000 (10:47 -0700)
Tested-by: Tom Stellard <thomas.stellard@amd.com>
src/gallium/state_trackers/clover/core/platform.cpp

index e35b1f96da5c7702843b645266f1bae2c99e9ba6..762a015ca1a4b12b9792f7f1c94bacec80a4f856 100644 (file)
@@ -33,6 +33,8 @@ platform::platform() : adaptor_range(derefs(), devs) {
    for (pipe_loader_device *ldev : ldevs) {
       try {
          devs.push_back(transfer(new device(*this, ldev)));
-      } catch (error &) {}
+      } catch (error &) {
+         pipe_loader_release(&ldev, 1);
+      }
    }
 }