mirror of
https://github.com/wiiu-env/WiiUPluginSystem.git
synced 2025-01-11 09:09:06 +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;
|
parent->data_size += INCREASE_SIZE_BY;
|
||||||
|
|
||||||
foundItem->key = (char *) malloc(strlen(key) + 1);
|
foundItem->key = strdup(key);
|
||||||
if (foundItem->key == nullptr) {
|
if (foundItem->key == nullptr) {
|
||||||
foundItem->pending_delete = true;
|
foundItem->pending_delete = true;
|
||||||
*error = WUPS_STORAGE_ERROR_MALLOC_FAILED;
|
*error = WUPS_STORAGE_ERROR_MALLOC_FAILED;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
strcpy(foundItem->key, key);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foundItem->type = type;
|
foundItem->type = type;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user