From 086c4895e43c80be16cade646a1b1d44fee853c2 Mon Sep 17 00:00:00 2001 From: Karl Schultz Date: Thu, 6 Dec 2018 16:10:25 -0700 Subject: vulkaninfo: Fix memory init/leak - Clear the structures allocated for the pNext chains. While this is not strictly necessary, any pNext structure that is not filled in by a driver (because the extension isn't there) gets left in an untouched state. This can be a false positive flagged by valgrind. - Use XFree to free storage allocated by Xlib's XGetVisualInfo(). This fixes an actual leak. --- vulkaninfo/vulkaninfo.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vulkaninfo/vulkaninfo.c b/vulkaninfo/vulkaninfo.c index 4d4838ce..e060d36d 100644 --- a/vulkaninfo/vulkaninfo.c +++ b/vulkaninfo/vulkaninfo.c @@ -509,6 +509,7 @@ static void buildpNextChain(struct VkStructureHeader *first, const struct pNextC if (!place->pNext) { ERR_EXIT(VK_ERROR_OUT_OF_HOST_MEMORY); } + memset(place->pNext, 0, chain_info[i].mem_size); place = place->pNext; place->sType = chain_info[i].sType; } @@ -1206,6 +1207,7 @@ static void AppCreateXlibWindow(struct AppInstance *inst) { visualInfo->visual, 0, NULL); XSync(inst->xlib_display,false); + XFree(visualInfo); } static void AppCreateXlibSurface(struct AppInstance *inst) { -- cgit v1.2.3