]> code.delx.au - pulseaudio/commitdiff
Revert "Revert "role-cork: Fix a minor leak""
authorArun Raghavan <arun.raghavan@collabora.co.uk>
Tue, 3 Jul 2012 12:34:48 +0000 (18:04 +0530)
committerArun Raghavan <arun.raghavan@collabora.co.uk>
Tue, 3 Jul 2012 12:45:54 +0000 (18:15 +0530)
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.

src/modules/module-role-cork.c

index 70e1628f9fc9cae54f54066ed2ecbb2016c75550..8306987e46ed97b0e612ab1af246bbe47f6765d2 100644 (file)
@@ -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.");