summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEdward O'Callaghan <[email protected]>2016-10-11 22:43:07 +1100
committerDave Airlie <[email protected]>2016-10-12 08:46:10 +1000
commite0641c61ca5cb8bba2e4cb5a0a6eede74f11ebc6 (patch)
tree9f8b830906d054c761072737b78f0444c687b45f /src
parent4a0db58f144d5476bf3fe277848d946d224779c7 (diff)
radv/winsys: Fix mem leak at failed do_winsys_init() call site
Probably unlikely however ensure we don't leak a heap allocation on the fail path. V.2: also fix missing 'amdgpu_device_deinitialize()' calls (Emil Velikov). Signed-off-by: Edward O'Callaghan <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c
index 0ce44acd39d..04561007258 100644
--- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c
+++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c
@@ -337,13 +337,13 @@ radv_amdgpu_winsys_create(int fd)
ws = calloc(1, sizeof(struct radv_amdgpu_winsys));
if (!ws)
- return NULL;
+ goto fail;
ws->dev = dev;
ws->info.drm_major = drm_major;
ws->info.drm_minor = drm_minor;
if (!do_winsys_init(ws, fd))
- goto fail;
+ goto winsys_fail;
ws->debug_all_bos = getenv("RADV_DEBUG_ALL_BOS") ? true : false;
LIST_INITHEAD(&ws->global_bo_list);
@@ -355,6 +355,10 @@ radv_amdgpu_winsys_create(int fd)
radv_amdgpu_surface_init_functions(ws);
return &ws->base;
+
+winsys_fail:
+ free(ws);
fail:
+ amdgpu_device_deinitialize(dev);
return NULL;
}