From: Christian Brauner Date: Wed, 22 Nov 2017 13:13:07 +0000 (+0100) Subject: commands: don't traverse whole list X-Git-Tag: lxc-3.0.0.beta1~130^2~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b1ca434ae52c6b1ac9f73030d022e2a2e537cb3f;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 553382993..874a6f791 100644 --- a/src/lxc/commands.c +++ b/src/lxc/commands.c @@ -1176,6 +1176,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(); }