Code Review
/
src
/
app-framework-binder.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Fix bad memory access at client disconnection
[src/app-framework-binder.git]
/
src
/
afb-api-ws.c
diff --git
a/src/afb-api-ws.c
b/src/afb-api-ws.c
index
65daf02
..
dc45edb
100644
(file)
--- a/
src/afb-api-ws.c
+++ b/
src/afb-api-ws.c
@@
-130,7
+130,9
@@
static void api_ws_server_accept(struct api_ws_server *apiws)
close(fd);
} else {
server = afb_stub_ws_create_server(fdev, &apiws->uri[apiws->offapi], apiws->apiset);
close(fd);
} else {
server = afb_stub_ws_create_server(fdev, &apiws->uri[apiws->offapi], apiws->apiset);
- if (!server)
+ if (server)
+ afb_stub_ws_set_on_hangup(server, afb_stub_ws_unref);
+ else
ERROR("can't serve accepted connection to %s: %m", apiws->uri);
}
}
ERROR("can't serve accepted connection to %s: %m", apiws->uri);
}
}
@@
-144,7
+146,7
@@
static void api_ws_server_listen_callback(void *closure, uint32_t revents, struc
if ((revents & EPOLLIN) != 0)
api_ws_server_accept(apiws);
if ((revents & EPOLLIN) != 0)
api_ws_server_accept(apiws);
- if ((revents & EPOLLHUP) != 0)
+
else
if ((revents & EPOLLHUP) != 0)
api_ws_server_connect(apiws);
}
api_ws_server_connect(apiws);
}