diff options
| author | Antonin Descampe <antonin@gmail.com> | 2004-08-06 14:13:51 +0000 |
|---|---|---|
| committer | Antonin Descampe <antonin@gmail.com> | 2004-08-06 14:13:51 +0000 |
| commit | bc5c5115cbd4b5d6500348f7af2fa49e02b216ce (patch) | |
| tree | 66c869d78bf9a64845e59a3df7a36330595c7e26 /libopenjpeg/tcd.c | |
| parent | 61ac18531a62bcc31552875d2d9c5458bac452e2 (diff) | |
* Inserted tool for memory leaks fixing in debug mode
* Fixed some memory leaks in the decoder (some are still present when multiple tiles!)
Diffstat (limited to 'libopenjpeg/tcd.c')
| -rw-r--r-- | libopenjpeg/tcd.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/libopenjpeg/tcd.c b/libopenjpeg/tcd.c index ab71c129..ff9e0c95 100644 --- a/libopenjpeg/tcd.c +++ b/libopenjpeg/tcd.c @@ -1614,6 +1614,7 @@ int tcd_decode_tile(unsigned char *src, int len, int tileno) fprintf(stderr, "total: %ld.%.3ld s\n", time / CLOCKS_PER_SEC, (time % CLOCKS_PER_SEC) * 1000 / CLOCKS_PER_SEC); + for (compno = 0; compno < tile->numcomps; compno++) { free(tcd_image.tiles[tileno].comps[compno].data); } @@ -1624,3 +1625,30 @@ int tcd_decode_tile(unsigned char *src, int len, int tileno) return l; } + +void tcd_dec_release() +{ + int tileno,compno,resno,bandno,precno; + for (tileno=0;tileno<tcd_image.tw*tcd_image.th;tileno++) { + tcd_tile_t tile=tcd_image.tiles[tileno]; + for (compno=0;compno<tile.numcomps;compno++) { + tcd_tilecomp_t tilec=tile.comps[compno]; + for (resno=0;resno<tilec.numresolutions;resno++) { + tcd_resolution_t res=tilec.resolutions[resno]; + for (bandno=0;bandno<res.numbands;bandno++) { + tcd_band_t band=res.bands[bandno]; + for (precno=0;precno<res.ph*res.pw;precno++) { + tcd_precinct_t prec=band.precincts[precno]; + if (prec.cblks!=NULL) free(prec.cblks); + if (prec.imsbtree!=NULL) free(prec.imsbtree); + if (prec.incltree!=NULL) free(prec.incltree); + } + if (band.precincts!=NULL) free(band.precincts); + } + } + if (tilec.resolutions!=NULL) free(tilec.resolutions); + } + if (tile.comps!=NULL) free(tile.comps); + } + if (tcd_image.tiles!=NULL) free(tcd_image.tiles); +} |
