mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
fatfs: check allocated workbuf pointer
This commit is contained in:
parent
59859fa53c
commit
bf53c8abb1
@ -113,8 +113,12 @@ esp_err_t esp_vfs_fat_sdmmc_mount(const char* base_path,
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
ESP_LOGW(TAG, "partitioning card");
|
ESP_LOGW(TAG, "partitioning card");
|
||||||
DWORD plist[] = {100, 0, 0, 0};
|
|
||||||
workbuf = malloc(workbuf_size);
|
workbuf = malloc(workbuf_size);
|
||||||
|
if (workbuf == NULL) {
|
||||||
|
err = ESP_ERR_NO_MEM;
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
DWORD plist[] = {100, 0, 0, 0};
|
||||||
res = f_fdisk(s_pdrv, plist, workbuf);
|
res = f_fdisk(s_pdrv, plist, workbuf);
|
||||||
if (res != FR_OK) {
|
if (res != FR_OK) {
|
||||||
err = ESP_FAIL;
|
err = ESP_FAIL;
|
||||||
|
@ -79,6 +79,10 @@ esp_err_t esp_vfs_fat_spiflash_mount(const char* base_path,
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
workbuf = malloc(workbuf_size);
|
workbuf = malloc(workbuf_size);
|
||||||
|
if (workbuf == NULL) {
|
||||||
|
result = ESP_ERR_NO_MEM;
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
size_t alloc_unit_size = esp_vfs_fat_get_allocation_unit_size(
|
size_t alloc_unit_size = esp_vfs_fat_get_allocation_unit_size(
|
||||||
CONFIG_WL_SECTOR_SIZE,
|
CONFIG_WL_SECTOR_SIZE,
|
||||||
mount_config->allocation_unit_size);
|
mount_config->allocation_unit_size);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user