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=3c2a734bd8b447adcb6d96962ca4e49079aa6b2a;p=project%2Ffirmware-utils.git firmware-utils: tplink-safeloader: add calloc error handling Signed-off-by: Hyeonsik Song --- diff --git a/src/tplink-safeloader.c b/src/tplink-safeloader.c index b567b29..92d4485 100644 --- a/src/tplink-safeloader.c +++ b/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;