summaryrefslogtreecommitdiffhomepage
path: root/src/rlgl.c
diff options
context:
space:
mode:
authorRay <[email protected]>2017-02-01 00:28:28 +0100
committerRay <[email protected]>2017-02-01 00:28:28 +0100
commita08117155da1a0a439239ad8801a58b85f528014 (patch)
treeeaa4638170df055d86a4e7615d96ec09ff2b2200 /src/rlgl.c
parent495108a2e9a911c88c090f2ddd82391130701031 (diff)
downloadraylib-a08117155da1a0a439239ad8801a58b85f528014.tar.gz
raylib-a08117155da1a0a439239ad8801a58b85f528014.zip
Init memory for screenshot to zero
Diffstat (limited to 'src/rlgl.c')
-rw-r--r--src/rlgl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/rlgl.c b/src/rlgl.c
index 6c4e5927..ce17adc3 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);