提交 570edd3b 编写于 作者: A Alexander Beregalov 提交者: Greg Kroah-Hartman

staging: brcm80211: fix memory leaks

Free resources before exit.
Signed-off-by: NAlexander Beregalov <a.beregalov@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 ab42abf3
...@@ -5641,6 +5641,10 @@ static int dhdsdio_download_code_array(struct dhd_bus *bus) ...@@ -5641,6 +5641,10 @@ static int dhdsdio_download_code_array(struct dhd_bus *bus)
unsigned char *ularray; unsigned char *ularray;
ularray = kmalloc(bus->ramsize, GFP_ATOMIC); ularray = kmalloc(bus->ramsize, GFP_ATOMIC);
if (!ularray) {
bcmerror = BCME_NOMEM;
goto err;
}
/* Upload image to verify downloaded contents. */ /* Upload image to verify downloaded contents. */
offset = 0; offset = 0;
memset(ularray, 0xaa, bus->ramsize); memset(ularray, 0xaa, bus->ramsize);
...@@ -5652,7 +5656,7 @@ static int dhdsdio_download_code_array(struct dhd_bus *bus) ...@@ -5652,7 +5656,7 @@ static int dhdsdio_download_code_array(struct dhd_bus *bus)
DHD_ERROR(("%s: error %d on reading %d membytes" DHD_ERROR(("%s: error %d on reading %d membytes"
" at 0x%08x\n", " at 0x%08x\n",
__func__, bcmerror, MEMBLOCK, offset)); __func__, bcmerror, MEMBLOCK, offset));
goto err; goto free;
} }
offset += MEMBLOCK; offset += MEMBLOCK;
...@@ -5666,7 +5670,7 @@ static int dhdsdio_download_code_array(struct dhd_bus *bus) ...@@ -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", DHD_ERROR(("%s: error %d on reading %d membytes at 0x%08x\n",
__func__, bcmerror, __func__, bcmerror,
sizeof(dlarray) - offset, offset)); sizeof(dlarray) - offset, offset));
goto err; goto free;
} }
} }
...@@ -5674,11 +5678,11 @@ static int dhdsdio_download_code_array(struct dhd_bus *bus) ...@@ -5674,11 +5678,11 @@ static int dhdsdio_download_code_array(struct dhd_bus *bus)
DHD_ERROR(("%s: Downloaded image is corrupted.\n", DHD_ERROR(("%s: Downloaded image is corrupted.\n",
__func__)); __func__));
ASSERT(0); ASSERT(0);
goto err; goto free;
} else } else
DHD_ERROR(("%s: Download/Upload/Compare succeeded.\n", DHD_ERROR(("%s: Download/Upload/Compare succeeded.\n",
__func__)); __func__));
free:
kfree(ularray); kfree(ularray);
} }
#endif /* DHD_DEBUG */ #endif /* DHD_DEBUG */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册