summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 05f4df7)
raw | patch | inline | side by side (parent: 05f4df7)
author | Sebastian Harl <sh@tokkee.org> | |
Sat, 26 Oct 2013 11:51:06 +0000 (13:51 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sat, 26 Oct 2013 11:51:06 +0000 (13:51 +0200) |
… and fixed a memory leak.
src/frontend/sock.c | patch | blob | history |
diff --git a/src/frontend/sock.c b/src/frontend/sock.c
index be69f0ade8832c9076e301da44078cafb1c3fcf0..9fba695b6ef44c6e4ed79a933dafc93ba725128e 100644 (file)
--- a/src/frontend/sock.c
+++ b/src/frontend/sock.c
if ((! sock) || (! sock->listeners_num) || (! loop))
return -1;
+ if (sock->chan)
+ return -1;
+
FD_ZERO(&sockets);
for (i = 0; i < sock->listeners_num; ++i) {
if (! iter) {
sdb_log(SDB_LOG_ERR, "frontend: Failed to acquire iterator "
"for open connections");
- return -1;
+ break;
}
while (sdb_llist_iter_has_next(iter)) {
sdb_log(SDB_LOG_ERR, "frontend: Failed to monitor sockets: %s",
sdb_strerror(errno, buf, sizeof(buf)));
- return -1;
+ break;
}
if (! n)
if (! iter) {
sdb_log(SDB_LOG_ERR, "frontend: Failed to acquire iterator "
"for open connections");
- return -1;
+ break;
}
while (sdb_llist_iter_has_next(iter)) {
for (i = 0; i < SDB_STATIC_ARRAY_LEN(handler_threads); ++i)
pthread_join(handler_threads[i], NULL);
/* else: we tried our best; let the operating system clean up */
+
+ sdb_channel_destroy(sock->chan);
+ sock->chan = NULL;
return 0;
} /* sdb_fe_sock_listen_and_server */