Whamcloud - gitweb
ss_add_info_dir: fix error handling when memory allocation fails
authorWu Guanghao <wuguanghao3@huawei.com>
Wed, 28 Jul 2021 01:56:45 +0000 (09:56 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 3 Aug 2021 01:56:42 +0000 (21:56 -0400)
commitfeccf49871de4b05f9d99aca2df578947be98188
tree11305c83c45b7b220e00eb1972e0da3d2b90e3d8
parent53464654bd33e58e3fff079f34261b823d839f3b
ss_add_info_dir: fix error handling when memory allocation fails

If the realloc() and malloc() calls fail, avoid a memory leak as well
as a potential seg fault.

[ Fix error code setting to avoid depending on malloc() and realloc()
  setting errno. -- TYT ]

Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Reviewed-by: Wu Bo <wubo40@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ss/help.c