Use xmalloc

This commit is contained in:
simon.kagstrom 2010-02-25 11:47:16 +00:00
parent 407107d1a9
commit eef344a740

View File

@ -257,7 +257,7 @@ void *sdl_surface_to_png(SDL_Surface *surf, size_t *out_sz)
png_write_info(png_ptr, info_ptr); png_write_info(png_ptr, info_ptr);
png_set_packing(png_ptr); png_set_packing(png_ptr);
row_pointers = (png_bytep*) malloc(sizeof(png_bytep)*surf->h); row_pointers = (png_bytep*) xmalloc(sizeof(png_bytep)*surf->h);
for (i = 0; i < surf->h; i++) for (i = 0; i < surf->h; i++)
row_pointers[i] = (png_bytep)(Uint8 *)surf->pixels + i*surf->pitch; row_pointers[i] = (png_bytep)(Uint8 *)surf->pixels + i*surf->pitch;
png_write_image(png_ptr, row_pointers); png_write_image(png_ptr, row_pointers);