From 1ef3cf44a8eb9512480af4482a5232ea08363b14 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Tue, 5 Apr 2011 15:13:29 +0300 Subject: [PATCH] xz: Call lzma_end(&strm) before exiting if debugging is enabled. --- src/xz/coder.c | 10 ++++++++++ src/xz/coder.h | 5 +++++ src/xz/main.c | 4 ++++ 3 files changed, 19 insertions(+) diff --git a/src/xz/coder.c b/src/xz/coder.c index 5e5ed04c..c893f787 100644 --- a/src/xz/coder.c +++ b/src/xz/coder.c @@ -698,3 +698,13 @@ coder_run(const char *filename) return; } + + +#ifndef NDEBUG +extern void +coder_free(void) +{ + lzma_end(&strm); + return; +} +#endif diff --git a/src/xz/coder.h b/src/xz/coder.h index 7edca039..35000438 100644 --- a/src/xz/coder.h +++ b/src/xz/coder.h @@ -65,3 +65,8 @@ extern void coder_set_compression_settings(void); /// Compress or decompress the given file extern void coder_run(const char *filename); + +#ifndef NDEBUG +/// Free the memory allocated for the coder and kill the worker threads. +extern void coder_free(void); +#endif diff --git a/src/xz/main.c b/src/xz/main.c index 8196c6e7..4e5b49e5 100644 --- a/src/xz/main.c +++ b/src/xz/main.c @@ -275,6 +275,10 @@ main(int argc, char **argv) list_totals(); } +#ifndef NDEBUG + coder_free(); +#endif + // If we have got a signal, raise it to kill the program instead // of calling tuklib_exit(). signals_exit();