[pulseaudio-commits] 19 commits - src/modules src/pulse src/pulsecore src/tests

Peter Meerwald pmeerw at kemper.freedesktop.org
Fri Dec 20 04:04:34 PST 2013


 src/modules/alsa/alsa-ucm.c                |    3 +--
 src/modules/alsa/module-alsa-card.c        |   15 ++++++++++++---
 src/modules/module-card-restore.c          |    2 +-
 src/modules/module-device-restore.c        |    1 +
 src/modules/module-equalizer-sink.c        |    2 +-
 src/modules/module-position-event-sounds.c |    5 +----
 src/modules/module-stream-restore.c        |    4 +++-
 src/modules/module-tunnel-sink-new.c       |    6 ++++--
 src/modules/module-virtual-surround-sink.c |    2 --
 src/modules/oss/module-oss.c               |    2 ++
 src/modules/raop/raop_client.c             |    3 ++-
 src/modules/rtp/module-rtp-send.c          |    6 ++++++
 src/pulse/mainloop.c                       |    4 +---
 src/pulsecore/core-util.c                  |    8 ++++++--
 src/pulsecore/iochannel.c                  |    2 +-
 src/pulsecore/protocol-native.c            |    3 ++-
 src/pulsecore/sink-input.c                 |    2 +-
 src/pulsecore/source-output.c              |    2 +-
 src/tests/sigbus-test.c                    |    1 +
 19 files changed, 47 insertions(+), 26 deletions(-)

New commits:
commit a8fea5c468c96b34d62f60062ea260048fd6d36d
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date:   Wed Dec 18 17:35:08 2013 +0100

    modules: Add assertion in equalizer-sink
    
    discovered by coverity
    
    Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>

diff --git a/src/modules/module-equalizer-sink.c b/src/modules/module-equalizer-sink.c
index 22043f0..bcaaecd 100644
--- a/src/modules/module-equalizer-sink.c
+++ b/src/modules/module-equalizer-sink.c
@@ -1585,7 +1585,7 @@ void dbus_init(struct userdata *u) {
     u->dbus_protocol=pa_dbus_protocol_get(u->sink->core);
     u->dbus_path=pa_sprintf_malloc("/org/pulseaudio/core1/sink%d", u->sink->index);
 
-    pa_dbus_protocol_add_interface(u->dbus_protocol, u->dbus_path, &equalizer_info, u);
+    pa_assert_se(pa_dbus_protocol_add_interface(u->dbus_protocol, u->dbus_path, &equalizer_info, u) >= 0);
     sink_list = pa_shared_get(u->sink->core, SINKLIST);
     u->database = pa_shared_get(u->sink->core, EQDB);
     if (sink_list == NULL) {

commit 25101b299dde374ae09b79f03a3b393b37981eda
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date:   Wed Dec 18 17:27:47 2013 +0100

    core: Fix check for io->output_event in enable_events()
    
    copy-pase error discovered by coverity
    
    Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>

diff --git a/src/pulsecore/iochannel.c b/src/pulsecore/iochannel.c
index ca0f350..dce6734 100644
--- a/src/pulsecore/iochannel.c
+++ b/src/pulsecore/iochannel.c
@@ -119,7 +119,7 @@ static void enable_events(pa_iochannel *io) {
                     io->mainloop->io_enable(io->output_event, PA_IO_EVENT_OUTPUT);
                 else
                     io->output_event = io->mainloop->io_new(io->mainloop, io->ofd, PA_IO_EVENT_OUTPUT, callback, io);
-            } else if (io->input_event) {
+            } else if (io->output_event) {
                 io->mainloop->io_free(io->output_event);
                 io->output_event = NULL;
             }

commit 402da5285a4a2f2cec2af7ca87ac95607424a238
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date:   Wed Dec 18 17:20:03 2013 +0100

    core: Remove dead code in pa_mainloop_run()
    
        while ((r = pa_mainloop_iterate(m, 1, retval)) >= 0)
            ;
    
         if (r == -2)
             return 1;
         else if (r < 0)
            return -1;
         else
            return 0;
    
    the last else is never reached, discovered by coverity
    
    Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>

diff --git a/src/pulse/mainloop.c b/src/pulse/mainloop.c
index 0e1fba0..66a1475 100644
--- a/src/pulse/mainloop.c
+++ b/src/pulse/mainloop.c
@@ -953,10 +953,8 @@ int pa_mainloop_run(pa_mainloop *m, int *retval) {
 
     if (r == -2)
         return 1;
-    else if (r < 0)
-        return -1;
     else
-        return 0;
+        return -1;
 }
 
 void pa_mainloop_quit(pa_mainloop *m, int retval) {

commit 67dc1a5a0bbafc28b9a4811b42afff491ef9fc67
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date:   Wed Dec 18 17:12:25 2013 +0100

    modules: Remove dead code in position-event-sounds
    
    ma is always NULL in fail path, discovered by coverity
    
    Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>

diff --git a/src/modules/module-position-event-sounds.c b/src/modules/module-position-event-sounds.c
index 531fee7..3bcad6a 100644
--- a/src/modules/module-position-event-sounds.c
+++ b/src/modules/module-position-event-sounds.c
@@ -144,7 +144,7 @@ static pa_hook_result_t sink_input_fixate_hook_callback(pa_core *core, pa_sink_i
 }
 
 int pa__init(pa_module*m) {
-    pa_modargs *ma = NULL;
+    pa_modargs *ma;
     struct userdata *u;
 
     pa_assert(m);
@@ -165,9 +165,6 @@ int pa__init(pa_module*m) {
 fail:
     pa__done(m);
 
-    if (ma)
-        pa_modargs_free(ma);
-
     return -1;
 }
 

commit e8ea0b8a795b40a58af61c713bf7fc30199847d4
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date:   Tue Dec 17 00:27:35 2013 +0100

    core: Use after free in pa_sink_input_new_data_set_formats() and pa_source_output_new_data_set_formats()
    
    intention is to free old data_req->formats before assigning
    new formats, discovered by coverity
    
    Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>

diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index b002467..8052724 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -218,7 +218,7 @@ bool pa_sink_input_new_data_set_formats(pa_sink_input_new_data *data, pa_idxset
     pa_assert(formats);
 
     if (data->req_formats)
-        pa_idxset_free(formats, (pa_free_cb_t) pa_format_info_free);
+        pa_idxset_free(data->req_formats, (pa_free_cb_t) pa_format_info_free);
 
     data->req_formats = formats;
 
diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c
index 7b78002..834a418 100644
--- a/src/pulsecore/source-output.c
+++ b/src/pulsecore/source-output.c
@@ -161,7 +161,7 @@ bool pa_source_output_new_data_set_formats(pa_source_output_new_data *data, pa_i
     pa_assert(formats);
 
     if (data->req_formats)
-        pa_idxset_free(formats, (pa_free_cb_t) pa_format_info_free);
+        pa_idxset_free(data->req_formats, (pa_free_cb_t) pa_format_info_free);
 
     data->req_formats = formats;
 

commit 4515f5d2ff83367059f09021635e164780c7e6bf
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date:   Mon Dec 16 23:54:13 2013 +0100

    tests: Fix resource leak in sigbus-test
    
    Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>

diff --git a/src/tests/sigbus-test.c b/src/tests/sigbus-test.c
index e5815e5..c48df8a 100644
--- a/src/tests/sigbus-test.c
+++ b/src/tests/sigbus-test.c
@@ -67,6 +67,7 @@ START_TEST (sigbus_test) {
 
     pa_memtrap_remove(m);
     munmap(p, PA_PAGE_SIZE);
+    close(fd);
 }
 END_TEST
 

commit 5196453117cfbbb96e07636e2572c6702d58e462
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date:   Mon Dec 16 18:10:36 2013 +0100

    modules: Remove redundant code in virtual-surround-sink
    
    https://scan7.coverity.com:8443/reports.htm#v10206/p10016/fileInstanceId=8788&defectInstanceId=3710&mergedDefectId=591297
    
    Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>

diff --git a/src/modules/module-virtual-surround-sink.c b/src/modules/module-virtual-surround-sink.c
index 356ca22..1d6cfc6 100644
--- a/src/modules/module-virtual-surround-sink.c
+++ b/src/modules/module-virtual-surround-sink.c
@@ -568,8 +568,6 @@ int pa__init(pa_module*m) {
 
     /* Initialize hrir and input buffer */
     /* this is the hrir file for the left ear! */
-    hrir_file = pa_modargs_get_value(ma, "hrir", NULL);
-
     if (!(hrir_file = pa_modargs_get_value(ma, "hrir", NULL))) {
         pa_log("The mandatory 'hrir' module argument is missing.");
         goto fail;

commit 94deb3725d145d98191ab5db089ff30ad3805faa
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date:   Mon Dec 16 18:01:37 2013 +0100

    core: Fix asserting command in protocol-native
    
    https://scan7.coverity.com:8443/reports.htm#v10206/p10016/fileInstanceId=8690&defectInstanceId=3688&mergedDefectId=591259
    
    Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>

diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index 071e5e2..7361a89 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -4745,7 +4745,7 @@ static void command_set_sink_or_source_port(pa_pdispatch *pd, uint32_t command,
     } else {
         pa_source *source;
 
-        pa_assert(command = PA_COMMAND_SET_SOURCE_PORT);
+        pa_assert(command == PA_COMMAND_SET_SOURCE_PORT);
 
         if (idx != PA_INVALID_INDEX)
             source = pa_idxset_get_by_index(c->protocol->core->sources, idx);

commit d3cddfed5cf600c504f15949a7583f9c055aa17c
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date:   Mon Dec 16 17:22:10 2013 +0100

    modules: Fix uninit value in rtp-send
    
    https://scan7.coverity.com:8443/reports.htm#v10205/p10016/fileInstanceId=8803&defectInstanceId=3705&mergedDefectId=591292&eventIds=3705-36&eventId=3705-36
    
    see http://silviocesare.wordpress.com/2007/10/22/setting-sin_zero-to-0-in-struct-sockaddr_in/
    
    Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>

diff --git a/src/modules/rtp/module-rtp-send.c b/src/modules/rtp/module-rtp-send.c
index 7f05277..997872e 100644
--- a/src/modules/rtp/module-rtp-send.c
+++ b/src/modules/rtp/module-rtp-send.c
@@ -251,11 +251,14 @@ int pa__init(pa_module*m) {
     if (inet_pton(AF_INET, src_addr, &src_sa4.sin_addr) > 0) {
         src_sa4.sin_family = af = AF_INET;
         src_sa4.sin_port = htons(0);
+        memset(&src_sa4.sin_zero, 0, sizeof(src_sa4.sin_zero));
         src_sap_sa4 = src_sa4;
 #ifdef HAVE_IPV6
     } else if (inet_pton(AF_INET6, src_addr, &src_sa6.sin6_addr) > 0) {
         src_sa6.sin6_family = af = AF_INET6;
         src_sa6.sin6_port = htons(0);
+        src_sa6.sin6_flowinfo = 0;
+        src_sa6.sin6_scope_id = 0;
         src_sap_sa6 = src_sa6;
 #endif
     } else {
@@ -270,12 +273,15 @@ int pa__init(pa_module*m) {
     if (inet_pton(AF_INET, dst_addr, &dst_sa4.sin_addr) > 0) {
         dst_sa4.sin_family = af = AF_INET;
         dst_sa4.sin_port = htons((uint16_t) port);
+        memset(&dst_sa4.sin_zero, 0, sizeof(dst_sa4.sin_zero));
         dst_sap_sa4 = dst_sa4;
         dst_sap_sa4.sin_port = htons(SAP_PORT);
 #ifdef HAVE_IPV6
     } else if (inet_pton(AF_INET6, dst_addr, &dst_sa6.sin6_addr) > 0) {
         dst_sa6.sin6_family = af = AF_INET6;
         dst_sa6.sin6_port = htons((uint16_t) port);
+        dst_sa6.sin6_flowinfo = 0;
+        src_sa6.sin6_scope_id = 0;
         dst_sap_sa6 = dst_sa6;
         dst_sap_sa6.sin6_port = htons(SAP_PORT);
 #endif

commit e11b699d45fa3dca2cde8a976cbf25490f5501a4
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date:   Mon Dec 16 17:11:07 2013 +0100

    core: Fix uninit pointer read in protocol-native
    
    https://scan7.coverity.com:8443/reports.htm#v10205/p10016/fileInstanceId=8690&defectInstanceId=3703&mergedDefectId=591290&eventIds=3703-7&eventId=3703-7
    
    Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>

diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index 662de98..071e5e2 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -4780,6 +4780,7 @@ static void command_set_port_latency_offset(pa_pdispatch *pd, uint32_t command,
         pa_tagstruct_gets64(t, &offset) < 0 ||
         !pa_tagstruct_eof(t)) {
         protocol_error(c);
+        return;
     }
 
     CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);

commit 7fca92627b287ee00722e16e11874ec4097a6242
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date:   Mon Dec 16 17:00:24 2013 +0100

    modules: Fix resource leak in card-restore
    
    https://scan7.coverity.com:8443/reports.htm#v10205/p10016/fileInstanceId=8728&defectInstanceId=3737&mergedDefectId=591274
    
    Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>

diff --git a/src/modules/module-card-restore.c b/src/modules/module-card-restore.c
index 3134067..252dcce 100644
--- a/src/modules/module-card-restore.c
+++ b/src/modules/module-card-restore.c
@@ -442,7 +442,7 @@ static pa_hook_result_t port_offset_change_callback(pa_core *c, pa_device_port *
         pa_log_info("Storing latency offset for port %s on card %s.", port->name, card->name);
 
     } else {
-        entry_from_card(card);
+        entry = entry_from_card(card);
         show_full_info(card);
     }
 

commit 9d3d732a63749763a2c19ef56d512cfc33691161
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date:   Mon Dec 16 16:44:28 2013 +0100

    modules: Fix resource leak in raop_client
    
    https://scan7.coverity.com:8443/reports.htm#v10205/p10016/fileInstanceId=8899&defectInstanceId=3735&mergedDefectId=591272
    
    Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>

diff --git a/src/modules/raop/raop_client.c b/src/modules/raop/raop_client.c
index 98a9822..5bb0bb4 100644
--- a/src/modules/raop/raop_client.c
+++ b/src/modules/raop/raop_client.c
@@ -367,7 +367,7 @@ static void rtsp_cb(pa_rtsp_client *rtsp, pa_rtsp_state state, pa_headerlist* he
 
 pa_raop_client* pa_raop_client_new(pa_core *core, const char* host) {
     pa_parsed_address a;
-    pa_raop_client* c = pa_xnew0(pa_raop_client, 1);
+    pa_raop_client* c;
 
     pa_assert(core);
     pa_assert(host);
@@ -375,6 +375,7 @@ pa_raop_client* pa_raop_client_new(pa_core *core, const char* host) {
     if (pa_parse_address(host, &a) < 0 || a.type == PA_PARSED_ADDRESS_UNIX)
         return NULL;
 
+    c = pa_xnew0(pa_raop_client, 1);
     c->core = core;
     c->fd = -1;
 

commit 7978baaf814984a168373e671f8b29c06fb60a92
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date:   Mon Dec 16 16:40:03 2013 +0100

    modules: Fix resource leak in tunnel-sink-new
    
    https://scan7.coverity.com:8443/reports.htm#v10205/p10016/fileInstanceId=8770&defectInstanceId=3733&mergedDefectId=591270
    
    Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>

diff --git a/src/modules/module-tunnel-sink-new.c b/src/modules/module-tunnel-sink-new.c
index 8d04092..484e538 100644
--- a/src/modules/module-tunnel-sink-new.c
+++ b/src/modules/module-tunnel-sink-new.c
@@ -287,10 +287,12 @@ static void context_state_cb(pa_context *c, void *userdata) {
             pa_proplist *proplist;
             pa_buffer_attr bufferattr;
             pa_usec_t requested_latency;
-            const char *username = pa_get_user_name_malloc();
-            const char *hostname = pa_get_host_name_malloc();
+            char *username = pa_get_user_name_malloc();
+            char *hostname = pa_get_host_name_malloc();
             /* TODO: old tunnel put here the remote sink_name into stream name e.g. 'Null Output for lynxis at lazus' */
             char *stream_name = pa_sprintf_malloc(_("Tunnel for %s@%s"), username, hostname);
+            pa_xfree(hostname);
+            pa_xfree(username);
 
             pa_log_debug("Connection successful. Creating stream.");
             pa_assert(!u->stream);

commit ff9e9e05df686f14f77c99fd1ed5f523b73bccb6
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date:   Mon Dec 16 16:35:50 2013 +0100

    core: Fix resource leak in core-util
    
    https://scan7.coverity.com:8443/reports.htm#v10205/p10016/fileInstanceId=8477&defectInstanceId=3693&mergedDefectId=591269
    
    Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>

diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index 2efa280..0d9e354 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -326,16 +326,20 @@ again:
         goto fail;
     }
 
-    if (!update_perms)
+    if (!update_perms) {
+        pa_assert_se(pa_close(fd) >= 0);
         return 0;
+    }
 
 #ifdef HAVE_FCHOWN
     if (uid == (uid_t) -1)
         uid = getuid();
     if (gid == (gid_t) -1)
         gid = getgid();
-    if (fchown(fd, uid, gid) < 0)
+    if (fchown(fd, uid, gid) < 0) {
+        pa_assert_se(pa_close(fd) >= 0);
         goto fail;
+    }
 #endif
 
 #ifdef HAVE_FCHMOD

commit c2e9f1fdecde294e2eddbfb42a55b2d02036185f
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date:   Mon Dec 16 16:31:20 2013 +0100

    modules: Fix resource leak in oss
    
    https://scan7.coverity.com:8443/reports.htm#v10205/p10016/fileInstanceId=8824&defectInstanceId=3731&mergedDefectId=591267
    
    Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>

diff --git a/src/modules/oss/module-oss.c b/src/modules/oss/module-oss.c
index 03e51c8..d661bde 100644
--- a/src/modules/oss/module-oss.c
+++ b/src/modules/oss/module-oss.c
@@ -1329,6 +1329,7 @@ int pa__init(pa_module*m) {
         if (pa_modargs_get_proplist(ma, "source_properties", source_new_data.proplist, PA_UPDATE_REPLACE) < 0) {
             pa_log("Invalid properties");
             pa_source_new_data_done(&source_new_data);
+            pa_xfree(name_buf);
             goto fail;
         }
 
@@ -1397,6 +1398,7 @@ int pa__init(pa_module*m) {
         if (pa_modargs_get_proplist(ma, "sink_properties", sink_new_data.proplist, PA_UPDATE_REPLACE) < 0) {
             pa_log("Invalid properties");
             pa_sink_new_data_done(&sink_new_data);
+            pa_xfree(name_buf);
             goto fail;
         }
 

commit 9a341c6b3615eda849c4a6ab58e8b0c4eee6bd8d
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date:   Mon Dec 16 16:25:44 2013 +0100

    modules: Fix resource leak in alsa-ucm
    
    https://scan7.coverity.com:8443/reports.htm#v10205/p10016/fileInstanceId=8833&defectInstanceId=3732&mergedDefectId=591268
    
    Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>

diff --git a/src/modules/alsa/alsa-ucm.c b/src/modules/alsa/alsa-ucm.c
index c88fc77..23522c7 100644
--- a/src/modules/alsa/alsa-ucm.c
+++ b/src/modules/alsa/alsa-ucm.c
@@ -1106,8 +1106,7 @@ static void alsa_mapping_add_ucm_modifier(pa_alsa_mapping *m, pa_alsa_ucm_modifi
         m->description = pa_xstrdup(new_desc);
     pa_xfree(cur_desc);
 
-    if (!m->description)
-        pa_xstrdup("");
+    m->description = m->description ? m->description : pa_xstrdup("");
 
     /* Modifier sinks should not be routed to by default */
     m->priority = 0;

commit a4b8a9d5a2514f1c5303556390b224e2220bb2ee
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date:   Mon Dec 16 16:15:09 2013 +0100

    modules: Fix resource leak in device-restore
    
    https://scan7.coverity.com:8443/reports.htm#v10205/p10016/fileInstanceId=8724&defectInstanceId=3728&mergedDefectId=591265
    
    Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>

diff --git a/src/modules/module-device-restore.c b/src/modules/module-device-restore.c
index 780b3e1..0490677 100644
--- a/src/modules/module-device-restore.c
+++ b/src/modules/module-device-restore.c
@@ -1152,6 +1152,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
                 pa_format_info *f = pa_format_info_new();
                 if (pa_tagstruct_get_format_info(t, f) < 0) {
                     pa_format_info_free(f);
+                    perportentry_free(e);
                     pa_xfree(name);
                     goto fail;
                 }

commit cfce437e4722bda26c83cef90b24799823db62a2
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date:   Mon Dec 16 16:03:10 2013 +0100

    modules: Fix resource leak in alsa-card
    
    https://scan7.coverity.com:8443/reports.htm#v10205/p10016/fileInstanceId=8851&defectInstanceId=3725&mergedDefectId=591261
    
    Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>

diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c
index be982ed..1a823d7 100644
--- a/src/modules/alsa/module-alsa-card.c
+++ b/src/modules/alsa/module-alsa-card.c
@@ -204,6 +204,7 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) {
     uint32_t idx;
     pa_alsa_mapping *am;
     pa_queue *sink_inputs = NULL, *source_outputs = NULL;
+    int ret = 0;
 
     pa_assert(c);
     pa_assert(new_profile);
@@ -245,8 +246,10 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) {
     /* if UCM is available for this card then update the verb */
     if (u->use_ucm) {
         if (pa_alsa_ucm_set_profile(&u->ucm, nd->profile ? nd->profile->name : NULL,
-                    od->profile ? od->profile->name : NULL) < 0)
-            return -1;
+                    od->profile ? od->profile->name : NULL) < 0) {
+            ret = -1;
+            goto finish;
+        }
     }
 
     if (nd->profile && nd->profile->output_mappings)
@@ -273,13 +276,14 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) {
             }
         }
 
+finish:
     if (sink_inputs)
         pa_sink_move_all_fail(sink_inputs);
 
     if (source_outputs)
         pa_source_move_all_fail(source_outputs);
 
-    return 0;
+    return ret;
 }
 
 static void init_profile(struct userdata *u) {
@@ -764,12 +768,17 @@ int pa__init(pa_module *m) {
                     "is abused (i.e. fixes are not pushed to ALSA), the decibel fix feature may be removed in some future "
                     "PulseAudio version.", u->card->name);
 
+    pa_modargs_free(ma);
+
     return 0;
 
 fail:
     if (reserve)
         pa_reserve_wrapper_unref(reserve);
 
+    if (ma)
+        pa_modargs_free(ma);
+
     pa__done(m);
 
     return -1;

commit bbed792cdf6fe823837aaa0f5dcefcf4f5ac1917
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date:   Mon Dec 16 15:54:29 2013 +0100

    modules: Fix resource leak in stream-restore
    
    https://scan7.coverity.com:8443/reports.htm#v10205/p10016/fileInstanceId=8726&defectInstanceId=3724&mergedDefectId=591260
    
    Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>

diff --git a/src/modules/module-stream-restore.c b/src/modules/module-stream-restore.c
index 7eb79ab..9689e79 100644
--- a/src/modules/module-stream-restore.c
+++ b/src/modules/module-stream-restore.c
@@ -2119,8 +2119,10 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
                     pa_tagstruct_get_channel_map(t, &entry->channel_map) ||
                     pa_tagstruct_get_cvolume(t, &entry->volume) < 0 ||
                     pa_tagstruct_gets(t, &device) < 0 ||
-                    pa_tagstruct_get_boolean(t, &muted) < 0)
+                    pa_tagstruct_get_boolean(t, &muted) < 0) {
+                    entry_free(entry);
                     goto fail;
+                }
 
                 if (!name || !*name) {
                     entry_free(entry);



More information about the pulseaudio-commits mailing list