summaryrefslogtreecommitdiffstats
path: root/src/bplist.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2015-01-31 20:21:07 +0100
committerGravatar Nikias Bassen2015-01-31 20:21:07 +0100
commit6a781e6f69cb820347bae02a1f947e6b01ccaa47 (patch)
treed4fe737067112cb05498e6d6bc06053723f4d13c /src/bplist.c
parent9da6e82da3552daf27bf50cc3308bdac886dc28d (diff)
downloadlibplist-6a781e6f69cb820347bae02a1f947e6b01ccaa47.tar.gz
libplist-6a781e6f69cb820347bae02a1f947e6b01ccaa47.tar.bz2
bplist: Plug memory leaks caused by unused (and unfreed) buffer
When parsing binary plists with BPLIST_DICT or BPLIST_ARRAY nodes that are referenced multiple times in a particular file, a buffer was allocated that was not used, and also not freed, thus causing memory leaks.
Diffstat (limited to 'src/bplist.c')
-rw-r--r--src/bplist.c5
1 files changed, 0 insertions, 5 deletions
diff --git a/src/bplist.c b/src/bplist.c
index cbe9481..5ddca26 100644
--- a/src/bplist.c
+++ b/src/bplist.c
@@ -584,14 +584,9 @@ static void* copy_plist_data(const void* src)
dstdata->strval = strdup(srcdata->strval);
break;
case PLIST_DATA:
- case PLIST_ARRAY:
dstdata->buff = (uint8_t*) malloc(sizeof(uint8_t) * srcdata->length);
memcpy(dstdata->buff, srcdata->buff, sizeof(uint8_t) * srcdata->length);
break;
- case PLIST_DICT:
- dstdata->buff = (uint8_t*) malloc(sizeof(uint8_t) * srcdata->length * 2);
- memcpy(dstdata->buff, srcdata->buff, sizeof(uint8_t) * srcdata->length * 2);
- break;
case PLIST_UID:
dstdata->intval = srcdata->intval;
break;