firmware-utils: tplink-safeloader: add calloc error handling
Signed-off-by: Hyeonsik Song <blogcin@naver.com>
This commit is contained in:
parent
eccde89aa4
commit
c2766270ef
1 changed files with 4 additions and 0 deletions
|
@ -1638,6 +1638,10 @@ static int add_flash_partition(
|
||||||
}
|
}
|
||||||
|
|
||||||
part_list->name = calloc(1, strlen(name) + 1);
|
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));
|
memcpy((char *)part_list->name, name, strlen(name));
|
||||||
part_list->base = base;
|
part_list->base = base;
|
||||||
part_list->size = size;
|
part_list->size = size;
|
||||||
|
|
Loading…
Reference in a new issue