diff options
Diffstat (limited to 'src/bplist.c')
| -rw-r--r-- | src/bplist.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/bplist.c b/src/bplist.c index cf9b9c6..1ab3ab8 100644 --- a/src/bplist.c +++ b/src/bplist.c | |||
| @@ -589,7 +589,11 @@ static gboolean free_index(gpointer key, gpointer value, gpointer user_data) | |||
| 589 | static void write_int(GByteArray * bplist, uint64_t val) | 589 | static void write_int(GByteArray * bplist, uint64_t val) |
| 590 | { | 590 | { |
| 591 | uint64_t size = get_needed_bytes(val); | 591 | uint64_t size = get_needed_bytes(val); |
| 592 | uint8_t *buff = (uint8_t *) malloc(sizeof(uint8_t) + size); | 592 | uint8_t *buff = NULL; |
| 593 | //do not write 3bytes int node | ||
| 594 | if (size == 3) | ||
| 595 | size++; | ||
| 596 | buff = (uint8_t *) malloc(sizeof(uint8_t) + size); | ||
| 593 | buff[0] = BPLIST_UINT | Log2(size); | 597 | buff[0] = BPLIST_UINT | Log2(size); |
| 594 | memcpy(buff + 1, &val, size); | 598 | memcpy(buff + 1, &val, size); |
| 595 | byte_convert(buff + 1, size); | 599 | byte_convert(buff + 1, size); |
