Bugfix in png_load.cpp

This commit is contained in:
Henrik Rydgård 2012-10-29 23:31:28 +01:00
parent 4b123b25cc
commit ae8688f245

View file

@ -31,8 +31,8 @@ int pngLoad(const char *file, int *pwidth,
// ... but 'n' will always be the number that it would have been if you said 0
// TODO: Get rid of this silly copy which is only to make the buffer free-able with free()
*image_data_ptr = (unsigned char *)malloc(x * y * n);
memcpy(*image_data_ptr, data, x * y * n);
*image_data_ptr = (unsigned char *)malloc(x * y * 4);
memcpy(*image_data_ptr, data, x * y * 4);
stbi_image_free(data);
return 1;
}
@ -134,4 +134,4 @@ int pngLoad(const char *file, int *pwidth,
return 1;
}
#endif
#endif