summaryrefslogtreecommitdiff
blob: 18f782fa7721e0c6ecea04fd18c6d6e9dd191241 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
From: David Bryant <david@wavpack.com>
Date: Sun, 8 Apr 2018 16:27:40 -0700
Subject: fix memory leaks

---
 src/common_utils.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/common_utils.c b/src/common_utils.c
index caf6b8f..629e60e 100644
--- a/src/common_utils.c
+++ b/src/common_utils.c
@@ -373,6 +373,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);