Skip to content
Permalink
Browse files

free the memory when getline() fail in add_one_node()

when getline() fail, the memory still need to be freed.

Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
  • Loading branch information...
yeyunfeng authored and yeyunfeng-dev committed Oct 6, 2019
1 parent 50f7f46 commit 403b17259db89fed7a037a98948da3930fed6b24
Showing with 3 additions and 4 deletions.
  1. +3 −4 numa.c
7 numa.c
@@ -74,12 +74,11 @@ static void add_one_node(const char *nodename)
cpus_clear(new->mask);
} else {
ret = getline(&cpustr, &blen, f);
if (ret <= 0) {
if (ret <= 0)
cpus_clear(new->mask);
} else {
else
cpumask_parse_user(cpustr, ret, new->mask);
free(cpustr);
}
free(cpustr);
}
fclose(f);
new->obj_type = OBJ_TYPE_NODE;

0 comments on commit 403b172

Please sign in to comment.
You can’t perform that action at this time.