mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-23 12:43:55 +08:00
staging: brcm80211: fix memory leaks
Free resources before exit. Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
ab42abf33a
commit
570edd3b23
@ -5641,6 +5641,10 @@ static int dhdsdio_download_code_array(struct dhd_bus *bus)
|
||||
unsigned char *ularray;
|
||||
|
||||
ularray = kmalloc(bus->ramsize, GFP_ATOMIC);
|
||||
if (!ularray) {
|
||||
bcmerror = BCME_NOMEM;
|
||||
goto err;
|
||||
}
|
||||
/* Upload image to verify downloaded contents. */
|
||||
offset = 0;
|
||||
memset(ularray, 0xaa, bus->ramsize);
|
||||
@ -5652,7 +5656,7 @@ static int dhdsdio_download_code_array(struct dhd_bus *bus)
|
||||
DHD_ERROR(("%s: error %d on reading %d membytes"
|
||||
" at 0x%08x\n",
|
||||
__func__, bcmerror, MEMBLOCK, offset));
|
||||
goto err;
|
||||
goto free;
|
||||
}
|
||||
|
||||
offset += MEMBLOCK;
|
||||
@ -5666,7 +5670,7 @@ static int dhdsdio_download_code_array(struct dhd_bus *bus)
|
||||
DHD_ERROR(("%s: error %d on reading %d membytes at 0x%08x\n",
|
||||
__func__, bcmerror,
|
||||
sizeof(dlarray) - offset, offset));
|
||||
goto err;
|
||||
goto free;
|
||||
}
|
||||
}
|
||||
|
||||
@ -5674,11 +5678,11 @@ static int dhdsdio_download_code_array(struct dhd_bus *bus)
|
||||
DHD_ERROR(("%s: Downloaded image is corrupted.\n",
|
||||
__func__));
|
||||
ASSERT(0);
|
||||
goto err;
|
||||
goto free;
|
||||
} else
|
||||
DHD_ERROR(("%s: Download/Upload/Compare succeeded.\n",
|
||||
__func__));
|
||||
|
||||
free:
|
||||
kfree(ularray);
|
||||
}
|
||||
#endif /* DHD_DEBUG */
|
||||
|
Loading…
Reference in New Issue
Block a user