aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lzmadec/lzmadec.c7
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;
}