From a72f2479af933c41253c30b3d4d1760d97230964 Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Tue, 14 Jan 2020 06:52:08 +0100 Subject: [PATCH] LoadPNGBuffer: use safe_malloc0 to allocate a zeored imate buffer valgrind reports there may be issues if this is not initialized --- tools/quake3/q3map2/image.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/quake3/q3map2/image.c b/tools/quake3/q3map2/image.c index e5f97a40..36658b86 100644 --- a/tools/quake3/q3map2/image.c +++ b/tools/quake3/q3map2/image.c @@ -230,7 +230,8 @@ static void LoadPNGBuffer( byte *buffer, int size, byte **pixels, int *width, in /* create image pixel buffer */ *width = w; *height = h; - *pixels = safe_malloc( w * h * 4 ); + /* initialize with zeros, this memory area may not be entirely rewritten */ + *pixels = safe_malloc0( w * h * 4 ); /* create row pointers */ rowPointers = safe_malloc( h * sizeof( byte* ) ); @@ -243,7 +244,6 @@ static void LoadPNGBuffer( byte *buffer, int size, byte **pixels, int *width, in /* clean up */ free( rowPointers ); png_destroy_read_struct( &png, &info, &end ); - } -- 2.39.2