diff options
| -rw-r--r-- | src/bplist.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/bplist.c b/src/bplist.c index 81bd716..20e5090 100644 --- a/src/bplist.c +++ b/src/bplist.c | |||
| @@ -289,6 +289,11 @@ static plist_t parse_string_node(const char **bnode, uint64_t size) | |||
| 289 | 289 | ||
| 290 | data->type = PLIST_STRING; | 290 | data->type = PLIST_STRING; |
| 291 | data->strval = (char *) malloc(sizeof(char) * (size + 1)); | 291 | data->strval = (char *) malloc(sizeof(char) * (size + 1)); |
| 292 | if (!data->strval) { | ||
| 293 | plist_free_data(data); | ||
| 294 | PLIST_BIN_ERR("%s: Could not allocate %" PRIu64 " bytes\n", __func__, sizeof(char) * (size + 1)); | ||
| 295 | return NULL; | ||
| 296 | } | ||
| 292 | memcpy(data->strval, *bnode, size); | 297 | memcpy(data->strval, *bnode, size); |
| 293 | data->strval[size] = '\0'; | 298 | data->strval[size] = '\0'; |
| 294 | data->length = strlen(data->strval); | 299 | data->length = strlen(data->strval); |
