mirror of
https://github.com/wiiu-env/WiiUPluginSystem.git
synced 2024-11-13 06:15:11 +01:00
StorageAPI: Use strdup if possible
This commit is contained in:
parent
52ac0d0c7a
commit
00f7bf0601
@ -245,13 +245,12 @@ static wups_storage_item_t *addItem(wups_storage_item_t *parent, const char *key
|
||||
|
||||
parent->data_size += INCREASE_SIZE_BY;
|
||||
|
||||
foundItem->key = (char *) malloc(strlen(key) + 1);
|
||||
foundItem->key = strdup(key);
|
||||
if (foundItem->key == nullptr) {
|
||||
foundItem->pending_delete = true;
|
||||
*error = WUPS_STORAGE_ERROR_MALLOC_FAILED;
|
||||
return nullptr;
|
||||
}
|
||||
strcpy(foundItem->key, key);
|
||||
}
|
||||
|
||||
foundItem->type = type;
|
||||
|
Loading…
Reference in New Issue
Block a user