Commit 6a781e6f authored by Nikias Bassen's avatar Nikias Bassen

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.
parent 9da6e82d
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment