]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/q3map2/image.c
LoadPNGBuffer: use safe_malloc0 to allocate a zeored imate buffer
[xonotic/netradiant.git] / tools / quake3 / q3map2 / image.c
index e5f97a40c1dbc8d4d71531bbc237926ef033020f..36658b86dead1f5578a8202a636e60325c6e16bb 100644 (file)
@@ -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 );
-
 }