summaryrefslogtreecommitdiffstats
path: root/src/afb-proto-ws.c
diff options
context:
space:
mode:
authorJose Bollo <jose.bollo@iot.bzh>2018-08-20 17:30:55 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2018-08-23 10:18:18 +0200
commit7b6940f1524cac6172e71529a989424ff18fb850 (patch)
treea2ec397272c66f07ed0089bb23762c3c5e4a0560 /src/afb-proto-ws.c
parent9490a0a5fe69f54aa30c4f75a79acde9d06a80f1 (diff)
afb-stub-ws: Safe handling of deconnections
This commit also include many comments and improvements in naming of functions. Bug-AGL: SPEC-1668 Change-Id: I1b5dd95678d94e9edfca1c598c5697e90bb9e5bf Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-proto-ws.c')
-rw-r--r--src/afb-proto-ws.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/afb-proto-ws.c b/src/afb-proto-ws.c
index 89d4522c..86112a32 100644
--- a/src/afb-proto-ws.c
+++ b/src/afb-proto-ws.c
@@ -1022,7 +1022,7 @@ struct afb_proto_ws *afb_proto_ws_create_server(struct fdev *fdev, const struct
void afb_proto_ws_unref(struct afb_proto_ws *protows)
{
- if (!__atomic_sub_fetch(&protows->refcount, 1, __ATOMIC_RELAXED)) {
+ if (protows && !__atomic_sub_fetch(&protows->refcount, 1, __ATOMIC_RELAXED)) {
afb_proto_ws_hangup(protows);
afb_ws_destroy(protows->ws);
pthread_mutex_destroy(&protows->mutex);