aboutsummaryrefslogtreecommitdiff
path: root/examples/textures_raw_data.c
diff options
context:
space:
mode:
authorRay <raysan5@gmail.com>2015-09-03 01:49:58 +0200
committerRay <raysan5@gmail.com>2015-09-03 01:49:58 +0200
commit77558eec0caf0736fa36c96b5807d928317d3dd7 (patch)
tree860d9e77d27729fa2572aa8207d77f8def083ccd /examples/textures_raw_data.c
parent858ccb350dab317483bf58a5852f88df0a49a7b2 (diff)
parentd05acb1b6878b101ecbde0aeb3aa1bcf80b960af (diff)
downloadraylib-1.3.0-installer.tar.gz
raylib-1.3.0-installer.zip
Merge pull request #28 from raysan5/develop1.3.0-installer1.3.0
Integrating Develop branch
Diffstat (limited to 'examples/textures_raw_data.c')
-rw-r--r--examples/textures_raw_data.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/examples/textures_raw_data.c b/examples/textures_raw_data.c
index a4ff71b3..d1922180 100644
--- a/examples/textures_raw_data.c
+++ b/examples/textures_raw_data.c
@@ -35,6 +35,7 @@ int main()
int width = 1024;
int height = 1024;
+ // Dynamic memory allocation to store pixels data (Color type)
Color *pixels = (Color *)malloc(width*height*sizeof(Color));
for (int y = 0; y < height; y++)
@@ -50,6 +51,8 @@ int main()
Image checkedIm = LoadImageEx(pixels, width, height);
Texture2D checked = LoadTextureFromImage(checkedIm);
UnloadImage(checkedIm); // Unload CPU (RAM) image data
+
+ // Dynamic memory must be freed after using it
free(pixels); // Unload CPU (RAM) pixels data
//---------------------------------------------------------------------------------------