[PATCH v2 07/19] modules: Fix resource leak in tunnel-sink-new

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Peter Meerwald <p.meerwald@xxxxxxxxxxxxxxxxxx>

https://scan7.coverity.com:8443/reports.htm#v10205/p10016/fileInstanceId=8770&defectInstanceId=3733&mergedDefectId=591270

Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>
---
 src/modules/module-tunnel-sink-new.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/modules/module-tunnel-sink-new.c b/src/modules/module-tunnel-sink-new.c
index 8d04092..484e538 100644
--- a/src/modules/module-tunnel-sink-new.c
+++ b/src/modules/module-tunnel-sink-new.c
@@ -287,10 +287,12 @@ static void context_state_cb(pa_context *c, void *userdata) {
             pa_proplist *proplist;
             pa_buffer_attr bufferattr;
             pa_usec_t requested_latency;
-            const char *username = pa_get_user_name_malloc();
-            const char *hostname = pa_get_host_name_malloc();
+            char *username = pa_get_user_name_malloc();
+            char *hostname = pa_get_host_name_malloc();
             /* TODO: old tunnel put here the remote sink_name into stream name e.g. 'Null Output for lynxis at lazus' */
             char *stream_name = pa_sprintf_malloc(_("Tunnel for %s@%s"), username, hostname);
+            pa_xfree(hostname);
+            pa_xfree(username);
 
             pa_log_debug("Connection successful. Creating stream.");
             pa_assert(!u->stream);
-- 
1.7.9.5



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux