lib/conf: check pointer return value when use calloc
add return value check when use calloc to create spdk_conf_section struct. Signed-off-by: sunshihao <sunshihao@huawei.com> Signed-off-by: linfeilong <linfeilong@huawei.com> Signed-off-by: liuzhqiang <liuzhiqiang26@huawei.com> Signed-off-by: suweifeng <suweifeng1@huawei.com> Change-Id: Iab89491b7c6942337fa7b1ab765e7bb509c1e92b Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5051 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
be979ad11e
commit
d2a0706982
@ -495,6 +495,10 @@ parse_line(struct spdk_conf *cp, char *lp)
|
||||
|
||||
if (sp == NULL) {
|
||||
sp = allocate_cf_section();
|
||||
if (sp == NULL) {
|
||||
SPDK_ERRLOG("cannot allocate cf section\n");
|
||||
return -1;
|
||||
}
|
||||
append_cf_section(cp, sp);
|
||||
|
||||
sp->name = strdup(key);
|
||||
|
Loading…
Reference in New Issue
Block a user