After you finish using the image library, clean up by
freeing any memory that was allocated by the image library in the
img_t
structure. For example:
-
If img_t::flags and IMG_DIRECT are set, you need to free
img_t::access.direct.data.
-
If img_t::format and IMG_FMT_PALETTE are set, and
img_t::npalette is greater than zero (0),
you need to free img_t::palette.
- Use img_lib_detach() to detach from the image library
and free all associated resources.
- If you created an input stream manually using
io_open(),
use
io_close() to close the input stream.
- If you used screen buffers to display the image, free the buffers and any associated
memory that is used by the Screen and Windowing API functions.