Fix some memory leaking
authorJoão Paulo Rechi Vita <joao.vita@gmail.com>
Thu, 21 Aug 2008 20:06:41 +0000 (17:06 -0300)
committerLennart Poettering <lennart@poettering.net>
Wed, 10 Sep 2008 22:12:08 +0000 (01:12 +0300)
src/modules/module-bt-device.c

index 053ef08..5bc0f28 100644 (file)
@@ -94,9 +94,9 @@ struct userdata {
     pa_memchunk memchunk;
     pa_mempool *mempool;
 
-    const char *name;
-    const char *addr;
-    const char *profile;
+    char *name;
+    char *addr;
+    char *profile;
     int rate;
     int channels;
     pa_sample_spec ss;
@@ -994,10 +994,20 @@ void pa__done(pa_module *m) {
 
     if (u->memchunk.memblock)
         pa_memblock_unref(u->memchunk.memblock);
+    /* TODO: free mempool */
 
     if (u->smoother)
         pa_smoother_free(u->smoother);
 
+    if (u->name)
+        pa_xfree(u->name);
+
+    if (u->addr)
+        pa_xfree(u->addr);
+
+    if (u->profile)
+        pa_xfree(u->profile);
+
     if (u->stream_fd >= 0)
         pa_close(u->stream_fd);