]> git.proxmox.com Git - mirror_lxc.git/commit - src/lxc/commands.c
commands_utils: fix socket leak when adding state client
authorMatthias Hardt <matthias.hardt@gmail.com>
Mon, 9 Mar 2020 18:58:22 +0000 (19:58 +0100)
committerMatthias Hardt <matthias.hardt@gmail.com>
Mon, 9 Mar 2020 18:58:22 +0000 (19:58 +0100)
commitebbca852973219065505d5c6d486eb0b6b2ea3b3
treea6d08b6d917033b65598cf394bf6269083341c95
parent2b3b8f65e3b6dd8cb51d916d60b72da7c2532515
commands_utils: fix socket leak when adding state client

If lxc_add_state_client() is called with the container already being in the desired state the client fd will never be closed and is leaking. This is due to setting stay_connected in lxc_cmd for LXC_CMD_ADD_STATE_CLIENT. If the desired state isn't already achieved the client fd will later be closed by calling lxc_cmd_fd_cleanup() but in the other case the client configuration isn't added to the handlers
state clients. So the client fd has to be closed explicitely.

This is simply tested by starting container A and calling lxc-wait -n A -s RUNNING.

Signed-off-by: Matthias Hardt <matthias.hardt@gmail.com>
src/lxc/commands.c
src/lxc/compiler.h