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: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent b6ebd1f2
...@@ -973,6 +973,10 @@ static void lxc_cmd_fd_cleanup(int fd, struct lxc_handler *handler, ...@@ -973,6 +973,10 @@ static void lxc_cmd_fd_cleanup(int fd, struct lxc_handler *handler,
lxc_list_del(cur); lxc_list_del(cur);
free(cur->elem); free(cur->elem);
free(cur); 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(); process_unlock();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment