From 27a8cbeed90f3f000ac59de3a527ac26f89b487b Mon Sep 17 00:00:00 2001 From: Leandro Ribeiro Date: Thu, 25 Apr 2024 13:48:18 -0300 Subject: [PATCH] shared: do not call png_destroy_read_struct() with uninitialized object If png_create_info_struct() fails, we should pass NULL to png_destroy_read_struct(), and not the address of the info we just failed to create. Signed-off-by: Leandro Ribeiro --- shared/image-loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/image-loader.c b/shared/image-loader.c index 2385c7a0..e9be208e 100644 --- a/shared/image-loader.c +++ b/shared/image-loader.c @@ -222,7 +222,7 @@ load_png(FILE *fp) info = png_create_info_struct(png); if (!info) { - png_destroy_read_struct(&png, &info, NULL); + png_destroy_read_struct(&png, NULL, NULL); return NULL; }