LSB Graphics Extensions Specification | ||
---|---|---|
<<< Previous | Next >>> |
This interface shall change the default behavior for freeing data, from only freeing internally allocated data (data allocated by libpng), to either freeing user-allocated data or not freeing any data at all. It only affects already allocated data.
This interface can enable deallocation of user data that was allocated with png_malloc() or png_zalloc() and passed to libpng with one of the png_set_*() interfaces. Users can call it both before and after calling such an interface. Calling it after reading PNG data but before calling such an interface controls whether the user or that interface is responsible for the existing data. Calling it after calling such an interface controls whether the user or that interface should deallocate the data.
If the user becomes responsible for data allocated by libpng, png_free() must be called to free it. If libpng becomes responsible for user-allocated data, the data must have been allocated with png_malloc() or png_zalloc().
The parameter png_ptr shall specify the PNG file.
The parameter info_ptr shall specify the PNG info structure.
The parameter freer shall specify one of these constants:
PNG_DESTROY_WILL_FREE_DATA
,
PNG_SET_WILL_FREE_DATA
,
PNG_USER_WILL_FREE_DATA
.
The parameter mask shall specify the data to free, as described under png_free_data().
A row_pointers
array allocated in a single block
must not be freed with
png_set_rows() or png_read_destroy(),
because they would attempt to free the elements of the array as well.
Do not free text_ptr
with libpng
if some of its members were allocated separately,
because it will actually only free text_ptr.key
.
If responsibility for freeing text_ptr
moves
from libpng to the user, the user
must not free the members separately.
<<< Previous | Home | Next >>> |
png_create_write_struct_2 | Up | png_destroy_info_struct |