[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v1.0-dev-227-g6041fc7

Colin Guthrie gitmailer-noreply at 0pointer.de
Mon Mar 28 06:55:27 PDT 2011


This is an automated email from the git hooks/post-receive script. It was
generated because of a push to the "PulseAudio Sound Server" repository.

The master branch has been updated
      from  77da2c4bcf843980fe27d4878a468741bdad3a38 (commit)

- Log -----------------------------------------------------------------
6041fc7 module-jack-sink/source: protect against null return in jack_get_ports
628137a cork-on-phone: Handle sink-inputs with NULL sinks
-----------------------------------------------------------------------

Summary of changes:
 src/modules/jack/module-jack-sink.c      |   13 ++++++++-----
 src/modules/jack/module-jack-source.c    |   13 ++++++++-----
 src/modules/module-cork-music-on-phone.c |    3 +++
 3 files changed, 19 insertions(+), 10 deletions(-)

-----------------------------------------------------------------------

commit 628137a62820b2659d41affe690cc8a1aedc89c0
Author: Arun Raghavan <arun.raghavan at collabora.co.uk>
Date:   Mon Mar 28 16:39:53 2011 +0530

    cork-on-phone: Handle sink-inputs with NULL sinks
    
    It's possible that by the time we receive the unlink hook, the given
    sink-input's sink is set to NULL. Handle this gracefully.

diff --git a/src/modules/module-cork-music-on-phone.c b/src/modules/module-cork-music-on-phone.c
index b629f06..5e6aa64 100644
--- a/src/modules/module-cork-music-on-phone.c
+++ b/src/modules/module-cork-music-on-phone.c
@@ -138,6 +138,9 @@ static pa_hook_result_t process(struct userdata *u, pa_sink_input *i, pa_bool_t
         !pa_streq(role, "video"))
         return PA_HOOK_OK;
 
+    if (!i->sink)
+        return PA_HOOK_OK;
+
     cork = shall_cork(i->sink, create ? NULL : i);
     apply_cork(u, i->sink, create ? NULL : i, cork);
 

commit 6041fc7042dee8e8988fd67fa0b790b9ab4db651
Author: David Henningsson <david.henningsson at canonical.com>
Date:   Mon Mar 28 15:16:12 2011 +0200

    module-jack-sink/source: protect against null return in jack_get_ports
    
    Just picking up a crash report from Ubuntu, here's the result.
    
    --
    David Henningsson, Canonical Ltd.
    http://launchpad.net/~diwic
    
    From 934c52c79bb6faed56a64d6e15f9b285f687afee Mon Sep 17 00:00:00 2001
    From: David Henningsson <david.henningsson at canonical.com>
    Date: Mon, 28 Mar 2011 14:30:44 +0200
    Subject: [PATCH] module-jack-sink/source: protect against null return in jack_get_ports
    
    According to jack_get_ports documentation, it seems like returning NULL
    is valid, and that it should be freed using jack_free.
    
    Reported-by: Grayson Peddie
    BugLink: http://bugs.launchpad.net/bugs/733424
    Signed-off-by: David Henningsson <david.henningsson at canonical.com>

diff --git a/src/modules/jack/module-jack-sink.c b/src/modules/jack/module-jack-sink.c
index 0b4e7ee..dfb5be1 100644
--- a/src/modules/jack/module-jack-sink.c
+++ b/src/modules/jack/module-jack-sink.c
@@ -343,8 +343,9 @@ int pa__init(pa_module*m) {
     ports = jack_get_ports(u->client, NULL, JACK_DEFAULT_AUDIO_TYPE, JackPortIsPhysical|JackPortIsInput);
 
     channels = 0;
-    for (p = ports; *p; p++)
-        channels++;
+    if (ports)
+        for (p = ports; *p; p++)
+            channels++;
 
     if (!channels)
         channels = m->core->default_sample_spec.channels;
@@ -432,7 +433,7 @@ int pa__init(pa_module*m) {
     if (do_connect) {
         for (i = 0, p = ports; i < ss.channels; i++, p++) {
 
-            if (!*p) {
+            if (!p || !*p) {
                 pa_log("Not enough physical output ports, leaving unconnected.");
                 break;
             }
@@ -448,7 +449,8 @@ int pa__init(pa_module*m) {
 
     pa_sink_put(u->sink);
 
-    free(ports);
+    if (ports)
+        jack_free(ports);
     pa_modargs_free(ma);
 
     return 0;
@@ -457,7 +459,8 @@ fail:
     if (ma)
         pa_modargs_free(ma);
 
-    free(ports);
+    if (ports)
+        jack_free(ports);
 
     pa__done(m);
 
diff --git a/src/modules/jack/module-jack-source.c b/src/modules/jack/module-jack-source.c
index 6b12840..8453bd9 100644
--- a/src/modules/jack/module-jack-source.c
+++ b/src/modules/jack/module-jack-source.c
@@ -289,8 +289,9 @@ int pa__init(pa_module*m) {
     ports = jack_get_ports(u->client, NULL, JACK_DEFAULT_AUDIO_TYPE, JackPortIsPhysical|JackPortIsOutput);
 
     channels = 0;
-    for (p = ports; *p; p++)
-        channels++;
+    if (ports)
+        for (p = ports; *p; p++)
+            channels++;
 
     if (!channels)
         channels = m->core->default_sample_spec.channels;
@@ -376,7 +377,7 @@ int pa__init(pa_module*m) {
     if (do_connect) {
         for (i = 0, p = ports; i < ss.channels; i++, p++) {
 
-            if (!*p) {
+            if (!p || !*p) {
                 pa_log("Not enough physical output ports, leaving unconnected.");
                 break;
             }
@@ -393,7 +394,8 @@ int pa__init(pa_module*m) {
 
     pa_source_put(u->source);
 
-    free(ports);
+    if (ports)
+        jack_free(ports);
     pa_modargs_free(ma);
 
     return 0;
@@ -402,7 +404,8 @@ fail:
     if (ma)
         pa_modargs_free(ma);
 
-    free(ports);
+    if (ports)
+        jack_free(ports);
 
     pa__done(m);
 

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list