fatfs: Fix some memory leak issues by coverity static analyzer.

This commit is contained in:
aditi_lonkar
2021-01-20 17:04:39 +05:30
committed by bot
parent 7bf205162c
commit 6e7780421b
2 changed files with 6 additions and 4 deletions

View File

@@ -5586,8 +5586,10 @@ FRESULT f_mkfs (
sz_buf = len / ss; /* Size of working buffer (sector) */
szb_buf = sz_buf * ss; /* Size of working buffer (byte) */
}
if (!buf || sz_buf == 0) return FR_NOT_ENOUGH_CORE;
if (!buf || sz_buf == 0) {
ff_memfree(buf);
return FR_NOT_ENOUGH_CORE;
}
/* Determine where the volume to be located (b_vol, sz_vol) */
if (FF_MULTI_PARTITION && part != 0) {
/* Get partition information from partition table in the MBR */