[PATCH] sink-input, source-output: Fix a leak during property change logging

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

 



Using pa_xfree() irrespective of whether old_value is NULL or not to
avoid potentially confusing nest of if statements.

CID: 1352052
---
 src/pulsecore/sink-input.c    | 4 +++-
 src/pulsecore/source-output.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index a7f6d55..1ed5dda 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -1436,8 +1436,10 @@ void pa_sink_input_set_property(pa_sink_input *i, const char *key, const char *v
         if (value && old_value) {
             if (pa_streq(value, old_value))
                 goto finish;
-        } else
+        } else {
+            pa_xfree(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 9e951ff..6c48bbc 100644
--- a/src/pulsecore/source-output.c
+++ b/src/pulsecore/source-output.c
@@ -1089,8 +1089,10 @@ void pa_source_output_set_property(pa_source_output *o, const char *key, const c
         if (value && old_value) {
             if (pa_streq(value, old_value))
                 goto finish;
-        } else
+        } else {
+            pa_xfree(old_value);
             old_value = pa_xstrdup("(data)");
+        }
     } else {
         if (!value)
             goto finish;
-- 
2.7.4



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

  Powered by Linux