[PATCH] bluetooth: Prevent aborts caused by invalid module arguments

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

 



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.

Signed-off-by: Jason Gerecke <killertofu at gmail.com>
---
 src/modules/bluetooth/module-bluetooth-policy.c | 3 ++-
 src/modules/bluetooth/module-bluez5-discover.c  | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/modules/bluetooth/module-bluetooth-policy.c b/src/modules/bluetooth/module-bluetooth-policy.c
index fc709ec..ede7c5f 100644
--- a/src/modules/bluetooth/module-bluetooth-policy.c
+++ b/src/modules/bluetooth/module-bluetooth-policy.c
@@ -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;
 }
-- 
2.6.4



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

  Powered by Linux