vk: Don't leak pipeline if initialization fails
authorKristian Høgsberg Kristensen <krh@owl.jf.intel.com>
Mon, 4 Jan 2016 18:42:50 +0000 (10:42 -0800)
committerKristian Høgsberg Kristensen <krh@owl.jf.intel.com>
Mon, 4 Jan 2016 18:42:50 +0000 (10:42 -0800)
src/vulkan/gen8_pipeline.c

index ae8ab404746eb9eea9311a6f2674b67e9aa55740..827a013ebdcfdde1563ed2cfecc7226f3ed364cc 100644 (file)
@@ -290,8 +290,10 @@ genX(graphics_pipeline_create)(
       return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
 
    result = anv_pipeline_init(pipeline, device, pCreateInfo, extra, pAllocator);
-   if (result != VK_SUCCESS)
+   if (result != VK_SUCCESS) {
+      anv_free2(&device->alloc, pAllocator, pipeline);
       return result;
+   }
 
    assert(pCreateInfo->pVertexInputState);
    emit_vertex_input(pipeline, pCreateInfo->pVertexInputState, extra);