diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2009-12-03 16:12:33 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2009-12-03 16:12:33 +0000 |
commit | 9bdf091c364ac7fac393c793ab6cc69f6b127da1 (patch) | |
tree | ae717e863dad2f7f5b594901ea006cc8b79e4990 /converter | |
parent | 79a18054f3cbc248af5c8b4e15303c827893fd2d (diff) | |
download | netpbm-mirror-9bdf091c364ac7fac393c793ab6cc69f6b127da1.tar.gz netpbm-mirror-9bdf091c364ac7fac393c793ab6cc69f6b127da1.tar.xz netpbm-mirror-9bdf091c364ac7fac393c793ab6cc69f6b127da1.zip |
Fix bug: don't do png_destroy_write() on a read structure
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1022 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter')
-rw-r--r-- | converter/other/pngx.c | 10 | ||||
-rw-r--r-- | converter/other/pngx.h | 8 |
2 files changed, 13 insertions, 5 deletions
diff --git a/converter/other/pngx.c b/converter/other/pngx.c index 602fdb33..22124b2a 100644 --- a/converter/other/pngx.c +++ b/converter/other/pngx.c @@ -69,6 +69,7 @@ pngx_create(struct pngx ** const pngxPP, else *pngxPP = pngxP; } + pngxP->rw = rw; } } @@ -77,7 +78,14 @@ pngx_create(struct pngx ** const pngxPP, void pngx_destroy(struct pngx * const pngxP) { - png_destroy_write_struct(&pngxP->png_ptr, &pngxP->info_ptr); + switch(pngxP->rw) { + case PNGX_READ: + png_destroy_read_struct(&pngxP->png_ptr, &pngxP->info_ptr, NULL); + break; + case PNGX_WRITE: + png_destroy_write_struct(&pngxP->png_ptr, &pngxP->info_ptr); + break; + } free(pngxP); } diff --git a/converter/other/pngx.h b/converter/other/pngx.h index 81487ca1..6b1aa73c 100644 --- a/converter/other/pngx.h +++ b/converter/other/pngx.h @@ -5,14 +5,14 @@ the PNG library easier and cleaner. */ +typedef enum {PNGX_READ, PNGX_WRITE} pngx_rw; + struct pngx { png_structp png_ptr; - png_infop info_ptr; + png_infop info_ptr; + pngx_rw rw; }; -typedef enum {PNGX_READ, PNGX_WRITE} pngx_rw; - - void pngx_create(struct pngx ** const pngxPP, pngx_rw const rw, |