[pulseaudio-commits] src/modules

Arun Raghavan arun at kemper.freedesktop.org
Fri Jan 15 03:07:41 PST 2016


 src/modules/bluetooth/module-bluetooth-policy.c |    5 +++--
 src/modules/bluetooth/module-bluez5-discover.c  |    3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 00ba3406181ff953f28a38e1ad19e6aa81e5d6dc
Author: Jason Gerecke <killertofu at gmail.com>
Date:   Wed Jan 13 20:27:39 2016 -0800

    bluetooth: Prevent aborts caused by invalid module arguments
    
    If 'pa_modargs_new' returns a NULL, we need to be careful to not call
    'pa_modargs_free' in the failure path since it requires that we pass it
    a non-null argument. Also updates 'module-bluetooth-policy.c:pa__init'
    to follow the standard "goto fail" pattern used everywhere else.
    
    Signed-off-by: Jason Gerecke <killertofu at gmail.com>

diff --git a/src/modules/bluetooth/module-bluetooth-policy.c b/src/modules/bluetooth/module-bluetooth-policy.c
index fc709ec..4e51846 100644
--- a/src/modules/bluetooth/module-bluetooth-policy.c
+++ b/src/modules/bluetooth/module-bluetooth-policy.c
@@ -225,7 +225,7 @@ int pa__init(pa_module *m) {
 
     if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
         pa_log_error("Failed to parse module arguments");
-        return -1;
+        goto fail;
     }
 
     m->userdata = u = pa_xnew0(struct userdata, 1);
@@ -261,7 +261,8 @@ int pa__init(pa_module *m) {
     return 0;
 
 fail:
-    pa_modargs_free(ma);
+    if (ma)
+        pa_modargs_free(ma);
     return -1;
 }
 
diff --git a/src/modules/bluetooth/module-bluez5-discover.c b/src/modules/bluetooth/module-bluez5-discover.c
index 1ccc1d1..080e5d0 100644
--- a/src/modules/bluetooth/module-bluez5-discover.c
+++ b/src/modules/bluetooth/module-bluez5-discover.c
@@ -137,7 +137,8 @@ int pa__init(pa_module *m) {
     return 0;
 
 fail:
-    pa_modargs_free(ma);
+    if (ma)
+        pa_modargs_free(ma);
     pa__done(m);
     return -1;
 }



More information about the pulseaudio-commits mailing list