From 0a72951de8feaaf4c6e1740b5cb5cd0401b00464 Mon Sep 17 00:00:00 2001 From: David Bryant Date: Sun, 8 Apr 2018 16:27:40 -0700 Subject: [PATCH 4/6] fix memory leaks --- src/common_utils.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git src/common_utils.c src/common_utils.c index c53db91..f8ddc63 100644 --- src/common_utils.c +++ src/common_utils.c @@ -384,6 +384,19 @@ WavpackContext *WavpackCloseFile (WavpackContext *wpc) WavpackFreeWrapper (wpc); + if (wpc->metadata) { + int i; + + for (i = 0; i < wpc->metacount; ++i) + if (wpc->metadata [i].data) + free (wpc->metadata [i].data); + + free (wpc->metadata); + } + + if (wpc->channel_identities) + free (wpc->channel_identities); + if (wpc->channel_reordering) free (wpc->channel_reordering); -- 2.17.0