1 |
From 6a781e6f69cb820347bae02a1f947e6b01ccaa47 Mon Sep 17 00:00:00 2001 |
2 |
From: Nikias Bassen <nikias@gmx.li> |
3 |
Date: Sat, 31 Jan 2015 20:21:07 +0100 |
4 |
Subject: [PATCH] bplist: Plug memory leaks caused by unused (and unfreed) |
5 |
buffer |
6 |
|
7 |
When parsing binary plists with BPLIST_DICT or BPLIST_ARRAY nodes that are |
8 |
referenced multiple times in a particular file, a buffer was allocated that |
9 |
was not used, and also not freed, thus causing memory leaks. |
10 |
--- |
11 |
src/bplist.c | 5 ----- |
12 |
1 file changed, 5 deletions(-) |
13 |
|
14 |
diff --git a/src/bplist.c b/src/bplist.c |
15 |
index cbe9481..5ddca26 100644 |
16 |
--- a/src/bplist.c |
17 |
+++ b/src/bplist.c |
18 |
@@ -584,14 +584,9 @@ static void* copy_plist_data(const void* src) |
19 |
dstdata->strval = strdup(srcdata->strval); |
20 |
break; |
21 |
case PLIST_DATA: |
22 |
- case PLIST_ARRAY: |
23 |
dstdata->buff = (uint8_t*) malloc(sizeof(uint8_t) * srcdata->length); |
24 |
memcpy(dstdata->buff, srcdata->buff, sizeof(uint8_t) * srcdata->length); |
25 |
break; |
26 |
- case PLIST_DICT: |
27 |
- dstdata->buff = (uint8_t*) malloc(sizeof(uint8_t) * srcdata->length * 2); |
28 |
- memcpy(dstdata->buff, srcdata->buff, sizeof(uint8_t) * srcdata->length * 2); |
29 |
- break; |
30 |
case PLIST_UID: |
31 |
dstdata->intval = srcdata->intval; |
32 |
break; |