mirror of
https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
synced 2024-12-04 07:23:33 +08:00
argv_parse: check return value of malloc in argv_parse()
In argv_parse(), return value of malloc should be checked whether it is NULL, otherwise, it may cause a segfault error. Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com> Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
parent
af03924f5b
commit
a61bc9e009
@ -116,6 +116,8 @@ int argv_parse(char *in_buf, int *ret_argc, char ***ret_argv)
|
||||
if (argv == 0) {
|
||||
argv = malloc(sizeof(char *));
|
||||
free(buf);
|
||||
if (!argv)
|
||||
return -1;
|
||||
}
|
||||
argv[argc] = 0;
|
||||
if (ret_argc)
|
||||
|
Loading…
Reference in New Issue
Block a user