afb-stub-ws: Protect against self-destruction
authorJosé Bollo <jose.bollo@iot.bzh>
Mon, 12 Feb 2018 17:03:38 +0000 (18:03 +0100)
committerJosé Bollo <jose.bollo@iot.bzh>
Tue, 13 Feb 2018 08:20:24 +0000 (09:20 +0100)
Change-Id: I43b15b8f675173a693816a0b8efd05fd024278f0
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
src/afb-stub-ws.c

index 1647592..a8af53c 100644 (file)
@@ -651,10 +651,12 @@ static void on_hangup(void *closure)
 {
        struct afb_stub_ws *stubws = closure;
 
+       afb_stub_ws_addref(stubws);
        if (stubws->on_hangup)
                stubws->on_hangup(stubws);
 
        release_sessions(stubws);
+       afb_stub_ws_unref(stubws);
 }
 
 /*****************************************************/