aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Schultz <karl@lunarg.com>2018-12-06 16:10:25 -0700
committerjeremyk-lunarg <jeremyk@lunarg.com>2018-12-07 09:06:31 -0700
commit086c4895e43c80be16cade646a1b1d44fee853c2 (patch)
tree0aca5e1b02f4815e621a2a18bd1f4299a97f0fb6
parent530732d15b736c3b29d615629035028cda2f032e (diff)
downloadusermoji-086c4895e43c80be16cade646a1b1d44fee853c2.tar.xz
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.
-rw-r--r--vulkaninfo/vulkaninfo.c2
1 files changed, 2 insertions, 0 deletions
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) {