Commit 112d7d77 authored by Libo Chen's avatar Libo Chen Committed by Pavel Emelyanov

crshow: fix potential fd leak

when pb_read_one_eof faild, we should close fd
Signed-off-by: 's avatarLibo Chen <libo.chen@huawei.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent ad6db833
......@@ -514,8 +514,10 @@ static int cr_show_pid(struct cr_options *opts, int pid)
PstreeEntry *pe;
ret = pb_read_one_eof(fd, &pe, PB_PSTREE);
if (ret <= 0)
if (ret <= 0){
close(fd);
return ret;
}
if (pe->pid == pid) {
pstree_item_from_pb(pe, &item);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment