Free NBD netlink sockets with nl_socket_free() #119
Reference in New Issue
Block a user
No description provided.
Delete Branch "koolkhel/vitastor:nbd-netlink-sock-free"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
netlink_sock_free() released the socket from nl_socket_alloc() with a
plain free(), leaking its file descriptor and its callback set. With
LeakSanitizer, netlink-unmap then exits with a non-zero code.
Tested with an ASan build of uStor, whose nbd_proxy.cpp has the same function. Without the fix,
netlink-unmapreported 224 bytes leaked in nl_cb_alloc() <- nl_socket_alloc() <- netlink_sock_alloc() <- netlink_disconnect() and exited non-zero. With it, there is no leak report and it exits 0.Contributor Name
Yury Luneff (MIND Software LLC, https://mindsw.io)
CLA