diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2008-01-15 17:46:59 +0200 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2008-01-15 17:46:59 +0200 |
commit | 01d71d60b79027e1ce3eb9c79ae5191e1407c883 (patch) | |
tree | 8b0276d51162ae704291d7ad4874a4e6b5ca0fe3 /src | |
parent | Fix memory leaks from test_block_header.c. (diff) | |
download | xz-01d71d60b79027e1ce3eb9c79ae5191e1407c883.tar.xz |
Free the allocated memory in lzmadec if debugging is
enabled. This should make it possible to detect possible
memory leaks with Valgrind.
Diffstat (limited to '')
-rw-r--r-- | src/lzmadec/lzmadec.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lzmadec/lzmadec.c b/src/lzmadec/lzmadec.c index fef49249..f0ae3568 100644 --- a/src/lzmadec/lzmadec.c +++ b/src/lzmadec/lzmadec.c @@ -513,5 +513,12 @@ main(int argc, char **argv) } while (++optind < argc); } +#ifndef NDEBUG + // Free the memory only when debugging. Freeing wastes some time, + // but allows detecting possible memory leaks with Valgrind. + lzma_end(&strm); + lzma_memlimit_end(mem_limitter, false); +#endif + return exit_status; } |