summaryrefslogtreecommitdiff
path: root/example.c
diff options
context:
space:
mode:
Diffstat (limited to 'example.c')
-rw-r--r--example.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/example.c b/example.c
index 88726dff1..aa920fe05 100644
--- a/example.c
+++ b/example.c
@@ -755,11 +755,13 @@ void write_png(char *file_name /* , ... other image information ... */)
allocated it with malloc() instead of png_malloc(), use free() instead
of png_free(). */
png_free(png_ptr, palette);
+ palette=NULL;
/* Similarly, if you png_malloced any data that you passed in with
png_set_something(), such as a hist or trans array, free it here,
when you can be sure that libpng is through with it. */
png_free(png_ptr, trans);
+ trans=NULL;
/* clean up after the write, and free any memory allocated */
png_destroy_write_struct(&png_ptr, &info_ptr);