summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/bplist.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/bplist.c b/src/bplist.c
index 20e5090..c1f6007 100644
--- a/src/bplist.c
+++ b/src/bplist.c
@@ -394,6 +394,11 @@ static plist_t parse_data_node(const char **bnode, uint64_t size)
data->type = PLIST_DATA;
data->length = size;
data->buff = (uint8_t *) malloc(sizeof(uint8_t) * size);
+ if (!data->strval) {
+ plist_free_data(data);
+ PLIST_BIN_ERR("%s: Could not allocate %" PRIu64 " bytes\n", __func__, sizeof(uint8_t) * size);
+ return NULL;
+ }
memcpy(data->buff, *bnode, sizeof(uint8_t) * size);
return node_create(NULL, data);