diff options
| author | 2015-01-31 20:21:07 +0100 | |
|---|---|---|
| committer | 2015-01-31 20:21:07 +0100 | |
| commit | 6a781e6f69cb820347bae02a1f947e6b01ccaa47 (patch) | |
| tree | d4fe737067112cb05498e6d6bc06053723f4d13c | |
| parent | 9da6e82da3552daf27bf50cc3308bdac886dc28d (diff) | |
| download | libplist-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.
| -rw-r--r-- | src/bplist.c | 5 |
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) | |||
| 584 | dstdata->strval = strdup(srcdata->strval); | 584 | dstdata->strval = strdup(srcdata->strval); |
| 585 | break; | 585 | break; |
| 586 | case PLIST_DATA: | 586 | case PLIST_DATA: |
| 587 | case PLIST_ARRAY: | ||
| 588 | dstdata->buff = (uint8_t*) malloc(sizeof(uint8_t) * srcdata->length); | 587 | dstdata->buff = (uint8_t*) malloc(sizeof(uint8_t) * srcdata->length); |
| 589 | memcpy(dstdata->buff, srcdata->buff, sizeof(uint8_t) * srcdata->length); | 588 | memcpy(dstdata->buff, srcdata->buff, sizeof(uint8_t) * srcdata->length); |
| 590 | break; | 589 | break; |
| 591 | case PLIST_DICT: | ||
| 592 | dstdata->buff = (uint8_t*) malloc(sizeof(uint8_t) * srcdata->length * 2); | ||
| 593 | memcpy(dstdata->buff, srcdata->buff, sizeof(uint8_t) * srcdata->length * 2); | ||
| 594 | break; | ||
| 595 | case PLIST_UID: | 590 | case PLIST_UID: |
| 596 | dstdata->intval = srcdata->intval; | 591 | dstdata->intval = srcdata->intval; |
| 597 | break; | 592 | break; |
