From: Christian Brauner Date: Wed, 22 Nov 2017 13:13:07 +0000 (+0100) Subject: commands: don't traverse whole list X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e1ff30a9a8ca20e43fcddbb3e217c472f97d91aa;p=thirdparty%2Flxc.git commands: don't traverse whole list When we remove a state client fd there's not reason to walk the whole list. We can simply break once we found and removed the fd. Signed-off-by: Christian Brauner --- diff --git a/src/lxc/commands.c b/src/lxc/commands.c index f5777afcf..eb9eac65e 100644 --- a/src/lxc/commands.c +++ b/src/lxc/commands.c @@ -973,6 +973,10 @@ static void lxc_cmd_fd_cleanup(int fd, struct lxc_handler *handler, lxc_list_del(cur); free(cur->elem); free(cur); + /* No need to walk the whole list. If we found the state client + * fd there can't be a second one. + */ + break; } process_unlock(); }