raop: Fix callback call in raop client after auth : only call once everything is...
authorckdo <chrisrodri@free.fr>
Thu, 24 Oct 2019 14:07:20 +0000 (16:07 +0200)
committerGeorg Chini <georg@chini.tk>
Sun, 22 Dec 2019 09:43:14 +0000 (09:43 +0000)
src/modules/raop/raop-client.c

index 9093252..e4dc9ea 100644 (file)
@@ -1325,10 +1325,11 @@ static void rtsp_auth_cb(pa_rtsp_client *rtsp, pa_rtsp_state_t state, pa_rtsp_st
                 c->password = NULL;
             }
 
-            if (c->state_callback)
-                c->state_callback((int) PA_RAOP_AUTHENTICATED, c->state_userdata);
             pa_rtsp_client_free(c->rtsp);
             c->rtsp = NULL;
+            /* Ensure everything is cleaned before calling the callback, otherwise it may raise a crash */
+            if (c->state_callback)
+                c->state_callback((int) PA_RAOP_AUTHENTICATED, c->state_userdata);
 
             waiting = false;
             break;