bcache-tools: check whether allocating memory fails in tree()

In tree(), we do not check whether malloc() returns NULL,
it may cause potential Null pointer dereference problem.
In addition, when we fail to list devices, we should free(out)
before return.

Signed-off-by: Zhiqiang Liu <lzhq28@mail.ustc.edu.cn>
Signed-off-by: Coly Li <colyli@suse.de>
1 file changed