From: Christian Brauner Date: Wed, 22 Nov 2017 13:13:07 +0000 (+0100) Subject: commands: don't traverse whole list X-Git-Tag: lxc-2.0.10~521 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa4401ae7ed5360b4e5d58b172772f945eb0d23e;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 d1ffecf41..0c3f4d7f6 100644 --- a/src/lxc/commands.c +++ b/src/lxc/commands.c @@ -972,6 +972,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(); }