From: Hyeonsik Song Date: Mon, 25 Jun 2018 02:02:43 +0000 (+0900) Subject: firmware-utils: tplink-safeloader: add calloc error handling X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=c2766270efcba795f1d14f9a51f07898eb8a62c1;p=openwrt%2Fstaging%2Fjogo.git firmware-utils: tplink-safeloader: add calloc error handling Signed-off-by: Hyeonsik Song --- diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c index b567b2950c..92d44856e5 100644 --- a/tools/firmware-utils/src/tplink-safeloader.c +++ b/tools/firmware-utils/src/tplink-safeloader.c @@ -1638,6 +1638,10 @@ static int add_flash_partition( } part_list->name = calloc(1, strlen(name) + 1); + if (!part_list->name) { + error(1, 0, "Unable to allocate memory"); + } + memcpy((char *)part_list->name, name, strlen(name)); part_list->base = base; part_list->size = size;