]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
commands: don't traverse whole list
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 22 Nov 2017 13:13:07 +0000 (14:13 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Fri, 15 Dec 2017 11:44:36 +0000 (12:44 +0100)
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 <christian.brauner@ubuntu.com>
src/lxc/commands.c

index f5777afcfb8cfb777a24e23fab74d0ed7f0426d4..eb9eac65e86e31a9698cb36c2890e9388e47fa47 100644 (file)
@@ -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();
 }