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: eda55c7c2f ("vulkan/screenshot-layer: Add Vulkan screenshot layer")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Casey Bowman <casey.g.bowman@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41325>
This commit is contained in:
Vinson Lee 2026-04-11 22:51:38 -07:00 committed by Marge Bot
parent 653ef90403
commit 4c46cd8e9d

View file

@ -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;