aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorHyeonsik Song <blogcin@naver.com>2018-06-25 11:02:43 +0900
committerMathias Kresin <dev@kresin.me>2018-07-04 01:20:01 +0200
commitc2766270efcba795f1d14f9a51f07898eb8a62c1 (patch)
tree52ad761d3aca5afb62ef2d4e52692f2a146d406b /tools
parenteccde89aa4764fd16b490e96e5dbbdb51cb0051b (diff)
downloadupstream-c2766270efcba795f1d14f9a51f07898eb8a62c1.tar.gz
upstream-c2766270efcba795f1d14f9a51f07898eb8a62c1.tar.bz2
upstream-c2766270efcba795f1d14f9a51f07898eb8a62c1.zip
firmware-utils: tplink-safeloader: add calloc error handling
Signed-off-by: Hyeonsik Song <blogcin@naver.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/firmware-utils/src/tplink-safeloader.c4
1 files changed, 4 insertions, 0 deletions
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;