mirror of
https://github.com/netdata/libbpf.git
synced 2026-04-09 01:59:06 +08:00
libbpf: Fix memleak in libbpf_netlink_recv()
Ensure that libbpf_netlink_recv() frees dynamically allocated buffer in
all code paths.
Fixes: 9c3de619e13e ("libbpf: Use dynamically allocated buffer when receiving netlink messages")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
Link: https://lore.kernel.org/bpf/20220217073958.276959-1-andrii@kernel.org
This commit is contained in:
committed by
Andrii Nakryiko
parent
6edaacad4f
commit
33201b7ebd
@@ -176,7 +176,8 @@ start:
|
|||||||
libbpf_nla_dump_errormsg(nh);
|
libbpf_nla_dump_errormsg(nh);
|
||||||
goto done;
|
goto done;
|
||||||
case NLMSG_DONE:
|
case NLMSG_DONE:
|
||||||
return 0;
|
ret = 0;
|
||||||
|
goto done;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -188,9 +189,10 @@ start:
|
|||||||
case NL_NEXT:
|
case NL_NEXT:
|
||||||
goto start;
|
goto start;
|
||||||
case NL_DONE:
|
case NL_DONE:
|
||||||
return 0;
|
ret = 0;
|
||||||
|
goto done;
|
||||||
default:
|
default:
|
||||||
return ret;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user