aboutsummaryrefslogtreecommitdiff
path: root/examples/textures_raw_data.c
diff options
context:
space:
mode:
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
//---------------------------------------------------------------------------------------