From 6224068586765337fa0adf969446d4b57b6708b6 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 23 Nov 2020 03:35:30 -0500 Subject: [PATCH] Fix some possible leaks. --- spa/plugins/alsa/acp/alsa-ucm.c | 3 ++- src/gst/gstpipewirecore.c | 6 ++++++ src/modules/module-protocol-pulse/pulse-server.c | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/spa/plugins/alsa/acp/alsa-ucm.c b/spa/plugins/alsa/acp/alsa-ucm.c index 46e3b016a..805849c23 100644 --- a/spa/plugins/alsa/acp/alsa-ucm.c +++ b/spa/plugins/alsa/acp/alsa-ucm.c @@ -1702,7 +1702,8 @@ static pa_alsa_jack* ucm_get_jack(pa_alsa_ucm_config *ucm, pa_alsa_ucm_device *d mixer_device_name = get_jack_mixer_device(device, false); if (!mixer_device_name) { pa_log("[%s] No mixer device name for JackControl \"%s\"", device_name, jack_control); - return NULL; + j = NULL; + goto finish; } j = pa_alsa_jack_new(NULL, mixer_device_name, name); PA_LLIST_PREPEND(pa_alsa_jack, ucm->jacks, j); diff --git a/src/gst/gstpipewirecore.c b/src/gst/gstpipewirecore.c index ef18fb89b..d53686af3 100644 --- a/src/gst/gstpipewirecore.c +++ b/src/gst/gstpipewirecore.c @@ -102,12 +102,18 @@ static GstPipeWireCore *make_core (int fd) mainloop_failed: { GST_ERROR ("error starting mainloop"); + pw_context_destroy (core->context); + pw_thread_loop_destroy (core->loop); + g_free (core); return NULL; } connection_failed: { GST_ERROR ("error connect: %m"); pw_thread_loop_unlock (core->loop); + pw_context_destroy (core->context); + pw_thread_loop_destroy (core->loop); + g_free (core); return NULL; } } diff --git a/src/modules/module-protocol-pulse/pulse-server.c b/src/modules/module-protocol-pulse/pulse-server.c index 31d6bc322..3b2ddcee7 100644 --- a/src/modules/module-protocol-pulse/pulse-server.c +++ b/src/modules/module-protocol-pulse/pulse-server.c @@ -2256,6 +2256,9 @@ static int do_finish_upload_stream(struct client *client, uint32_t command, uint error_errno: res = -errno; + if (sample != NULL) { + free(sample); + } goto error; error_invalid: res = -EINVAL;