}
}
-static void release_sessions(struct afb_stub_ws *stubws)
+static void release_all_sessions(struct afb_stub_ws *stubws)
{
- struct server_session *s;
+ struct server_session *s, *n;
- while((s = stubws->sessions)) {
- stubws->sessions = s->next;
+ s = stubws->sessions;
+ stubws->sessions = NULL;
+ while(s) {
+ n = s->next;
afb_session_unref(s->session);
free(s);
+ s = n;
}
}
if (stubws->on_hangup)
stubws->on_hangup(stubws);
- release_sessions(stubws);
+ release_all_sessions(stubws);
afb_stub_ws_unref(stubws);
}
drop_all_events(stubws);
if (stubws->listener)
afb_evt_listener_unref(stubws->listener);
- release_sessions(stubws);
+ release_all_sessions(stubws);
afb_proto_ws_unref(stubws->proto);
afb_cred_unref(stubws->cred);
afb_apiset_unref(stubws->apiset);