First remove the client from the list then close the fd. Otherwise we open
ourselves to a race where another codepath might be writing to a bad file
descriptor.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
continue;
/* kick client from list */
- close(client->clientfd);
lxc_list_del(cur);
+ close(client->clientfd);
free(cur->elem);
free(cur);
/* No need to walk the whole list. If we found the state client
}
/* kick client from list */
- close(client->clientfd);
lxc_list_del(cur);
+ close(client->clientfd);
free(cur->elem);
free(cur);
}