From dd927e1e83eff6ad95b8c17bc2cda32fd5b71a26 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 11 Apr 2026 22:51:38 -0700 Subject: [PATCH] vulkan/screenshot-layer: initialize info to NULL Initialize 'info' to NULL to avoid use of potentially uninitialized value at the cleanup label when an earlier error causes a goto before png_create_info_struct() is reached. screenshot.cpp:808:9: warning: variable 'info' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] screenshot.cpp:814:9: warning: variable 'info' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] Fixes: eda55c7c2f69 ("vulkan/screenshot-layer: Add Vulkan screenshot layer") Signed-off-by: Vinson Lee Reviewed-by: Casey Bowman (cherry picked from commit 4c46cd8e9dea94a4b6d94fefa0d0f58730c1b16f) Part-of: --- .pick_status.json | 2 +- src/vulkan/screenshot-layer/screenshot.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 58e64891831..39acf3a1e5d 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -514,7 +514,7 @@ "description": "vulkan/screenshot-layer: initialize info to NULL", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "eda55c7c2f695492e8ebdd26725e5be5ee66eb1c", "notes": null diff --git a/src/vulkan/screenshot-layer/screenshot.cpp b/src/vulkan/screenshot-layer/screenshot.cpp index cc25690c165..f257b83f4db 100644 --- a/src/vulkan/screenshot-layer/screenshot.cpp +++ b/src/vulkan/screenshot-layer/screenshot.cpp @@ -790,7 +790,7 @@ void *writePNG(void *data) { char *tmpFilename = (char *)malloc(length + 4); // Allow for ".tmp" VkResult res; png_byte *row_pointer; - png_infop info; + png_infop info = NULL; png_struct* png; uint64_t rowPitch = threadData->srLayout.rowPitch; uint64_t start_time, end_time;