[pulseaudio-discuss] [PATCH] sink-input, source-output: Fix logging, don't overwrite old_value when value == 0

Peter Meerwald-Stadler pmeerw at pmeerw.net
Mon Aug 15 17:11:50 UTC 2016


---
 src/pulsecore/sink-input.c    |   10 ++++------
 src/pulsecore/source-output.c |   10 ++++------
 2 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index 1ed5dda..435e63e 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -1433,13 +1433,11 @@ void pa_sink_input_set_property(pa_sink_input *i, const char *key, const char *v
 
     if (pa_proplist_contains(i->proplist, key)) {
         old_value = pa_xstrdup(pa_proplist_gets(i->proplist, key));
-        if (value && old_value) {
-            if (pa_streq(value, old_value))
-                goto finish;
-        } else {
-            pa_xfree(old_value);
+        if (value && old_value && pa_streq(value, old_value))
+            goto finish;
+
+        if (!old_value)
             old_value = pa_xstrdup("(data)");
-        }
     } else {
         if (!value)
             goto finish;
diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c
index c70af7a..35ef1c5 100644
--- a/src/pulsecore/source-output.c
+++ b/src/pulsecore/source-output.c
@@ -1086,13 +1086,11 @@ void pa_source_output_set_property(pa_source_output *o, const char *key, const c
 
     if (pa_proplist_contains(o->proplist, key)) {
         old_value = pa_xstrdup(pa_proplist_gets(o->proplist, key));
-        if (value && old_value) {
-            if (pa_streq(value, old_value))
-                goto finish;
-        } else {
-            pa_xfree(old_value);
+        if (value && old_value && pa_streq(value, old_value))
+            goto finish;
+
+        if (!old_value)
             old_value = pa_xstrdup("(data)");
-        }
     } else {
         if (!value)
             goto finish;
-- 
1.7.10.4



More information about the pulseaudio-discuss mailing list