From a08117155da1a0a439239ad8801a58b85f528014 Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 1 Feb 2017 00:28:28 +0100 Subject: [PATCH] Init memory for screenshot to zero --- src/rlgl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rlgl.c b/src/rlgl.c index 6c4e59272..ce17adc37 100644 --- a/src/rlgl.c +++ b/src/rlgl.c @@ -2198,7 +2198,7 @@ void rlglUnloadMesh(Mesh *mesh) // Read screen pixel data (color buffer) unsigned char *rlglReadScreenPixels(int width, int height) { - unsigned char *screenData = (unsigned char *)malloc(width*height*sizeof(unsigned char)*4); + unsigned char *screenData = (unsigned char *)calloc(width*height*4, sizeof(unsigned char)); // NOTE: glReadPixels returns image flipped vertically -> (0,0) is the bottom left corner of the framebuffer glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, screenData);