qpa_conn_init() receives a server string but never stores it. Save a
copy with g_strdup() and free it in qpa_conn_fini(), as intended in
original commit to allow connection reuse.

Reported-by: Pavee Hui <[email protected]>
Fixes: 9d34e6d8a1a1 ("paaudio: prepare for multiple audiodev")
Signed-off-by: Marc-André Lureau <[email protected]>
---
 audio/paaudio.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/audio/paaudio.c b/audio/paaudio.c
index 24327ecbf453..9d0a622fc5e6 100644
--- a/audio/paaudio.c
+++ b/audio/paaudio.c
@@ -747,6 +747,7 @@ static void qpa_validate_per_direction_opts(Audiodev *dev,
 static void *qpa_conn_init(const char *server)
 {
     PAConnection *c = g_new0(PAConnection, 1);
+    c->server = g_strdup(server);
     QTAILQ_INSERT_TAIL(&pa_conns, c, list);
 
     c->mainloop = pa_threaded_mainloop_new();
@@ -875,6 +876,7 @@ static void qpa_conn_fini(PAConnection *c)
     }
 
     QTAILQ_REMOVE(&pa_conns, c, list);
+    g_free(c->server);
     g_free(c);
 }
 

-- 
2.56.0.rc0.29.g47ce80527c56


Reply via email to