[pulseaudio-commits] 2 commits - src/modules

Arun Raghavan arun at kemper.freedesktop.org
Tue Jul 3 05:47:56 PDT 2012


 src/modules/module-role-cork.c |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

New commits:
commit 750a5c187a3177e9fddf92fb468c20f4fb2d6fe5
Author: Arun Raghavan <arun.raghavan at collabora.co.uk>
Date:   Tue Jul 3 18:11:54 2012 +0530

    role-cork: Fix another minor leak
    
    Credit to David for finding this one.

diff --git a/src/modules/module-role-cork.c b/src/modules/module-role-cork.c
index 8306987..8f8b58d 100644
--- a/src/modules/module-role-cork.c
+++ b/src/modules/module-role-cork.c
@@ -225,9 +225,12 @@ int pa__init(pa_module *m) {
     if (roles) {
         const char *split_state = NULL;
         char *n = NULL;
-        while ((n = pa_split(roles, ",", &split_state)))
+        while ((n = pa_split(roles, ",", &split_state))) {
             if (n[0] != '\0')
                 pa_idxset_put(u->trigger_roles, n, NULL);
+            else
+                pa_xfree(n);
+        }
     }
     if (pa_idxset_isempty(u->trigger_roles)) {
         pa_log_debug("Using role 'phone' as trigger role.");
@@ -239,9 +242,12 @@ int pa__init(pa_module *m) {
     if (roles) {
         const char *split_state = NULL;
         char *n = NULL;
-        while ((n = pa_split(roles, ",", &split_state)))
+        while ((n = pa_split(roles, ",", &split_state))) {
             if (n[0] != '\0')
                 pa_idxset_put(u->cork_roles, n, NULL);
+            else
+                pa_xfree(n);
+        }
     }
     if (pa_idxset_isempty(u->cork_roles)) {
         pa_log_debug("Using roles 'music' and 'video' as cork roles.");

commit ded196f93a26726089374f0eae20127bdca544a2
Author: Arun Raghavan <arun.raghavan at collabora.co.uk>
Date:   Tue Jul 3 18:04:48 2012 +0530

    Revert "Revert "role-cork: Fix a minor leak""
    
    This reverts commit a2c4bf22e0813d529f153c01d7421345a792f3bc.
    
    As Tanu points out, I'm stupid. The pa_xstrdup(n) was unnecessary
    because pa_split() allocates a new string for us.

diff --git a/src/modules/module-role-cork.c b/src/modules/module-role-cork.c
index 70e1628..8306987 100644
--- a/src/modules/module-role-cork.c
+++ b/src/modules/module-role-cork.c
@@ -227,7 +227,7 @@ int pa__init(pa_module *m) {
         char *n = NULL;
         while ((n = pa_split(roles, ",", &split_state)))
             if (n[0] != '\0')
-                pa_idxset_put(u->trigger_roles, pa_xstrdup(n), NULL);
+                pa_idxset_put(u->trigger_roles, n, NULL);
     }
     if (pa_idxset_isempty(u->trigger_roles)) {
         pa_log_debug("Using role 'phone' as trigger role.");
@@ -241,7 +241,7 @@ int pa__init(pa_module *m) {
         char *n = NULL;
         while ((n = pa_split(roles, ",", &split_state)))
             if (n[0] != '\0')
-                pa_idxset_put(u->cork_roles, pa_xstrdup(n), NULL);
+                pa_idxset_put(u->cork_roles, n, NULL);
     }
     if (pa_idxset_isempty(u->cork_roles)) {
         pa_log_debug("Using roles 'music' and 'video' as cork roles.");



More information about the pulseaudio-commits mailing list