From 36aa8ce3c9f34d41aa7fd94d90f23ba62f5caafb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Neusch=C3=A4fer?= Date: Mon, 18 Jul 2011 13:38:46 +0200 Subject: output/ao: add missing g_free in error path --- src/output/ao_plugin.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/output') diff --git a/src/output/ao_plugin.c b/src/output/ao_plugin.c index 6fedbc6e2..42ece5a3a 100644 --- a/src/output/ao_plugin.c +++ b/src/output/ao_plugin.c @@ -106,12 +106,14 @@ ao_output_init(G_GNUC_UNUSED const struct audio_format *audio_format, g_set_error(error, ao_output_quark(), 0, "\"%s\" is not a valid ao driver", value); + g_free(ad); return NULL; } if ((ai = ao_driver_info(ad->driver)) == NULL) { g_set_error(error, ao_output_quark(), 0, "problems getting driver info"); + g_free(ad); return NULL; } @@ -129,6 +131,7 @@ ao_output_init(G_GNUC_UNUSED const struct audio_format *audio_format, g_set_error(error, ao_output_quark(), 0, "problems parsing options \"%s\"", options[i]); + g_free(ad); return NULL; } -- cgit v1.2.3 From 296085ff23f3992f0f45fc0325c5bdbab953e114 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Neusch=C3=A4fer?= Date: Mon, 18 Jul 2011 14:35:04 +0200 Subject: output/httpd: add missing g_free in error path --- src/output/httpd_output_plugin.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/output') diff --git a/src/output/httpd_output_plugin.c b/src/output/httpd_output_plugin.c index 6650d89e3..b82dc0599 100644 --- a/src/output/httpd_output_plugin.c +++ b/src/output/httpd_output_plugin.c @@ -103,6 +103,7 @@ httpd_output_init(G_GNUC_UNUSED const struct audio_format *audio_format, if (encoder_plugin == NULL) { g_set_error(error, httpd_output_quark(), 0, "No such encoder: %s", encoder_name); + g_free(httpd); return NULL; } -- cgit v1.2.3 From a6a8bdffc35c3b592ca9eb908ef010a27ddbb3ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Neusch=C3=A4fer?= Date: Mon, 18 Jul 2011 15:39:19 +0200 Subject: output/recorder: fix a memory leak --- src/output/recorder_output_plugin.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/output') diff --git a/src/output/recorder_output_plugin.c b/src/output/recorder_output_plugin.c index c01d927c4..10d64106c 100644 --- a/src/output/recorder_output_plugin.c +++ b/src/output/recorder_output_plugin.c @@ -79,23 +79,27 @@ recorder_output_init(G_GNUC_UNUSED const struct audio_format *audio_format, if (encoder_plugin == NULL) { g_set_error(error_r, recorder_output_quark(), 0, "No such encoder: %s", encoder_name); - return NULL; + goto failure; } recorder->path = config_get_block_string(param, "path", NULL); if (recorder->path == NULL) { g_set_error(error_r, recorder_output_quark(), 0, "'path' not configured"); - return NULL; + goto failure; } /* initialize encoder */ recorder->encoder = encoder_init(encoder_plugin, param, error_r); if (recorder->encoder == NULL) - return NULL; + goto failure; return recorder; + +failure: + g_free(recorder); + return NULL; } static void -- cgit v1.2.3 From 7d6a605a859139dd1e22b6e7e91479b644d5f398 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Neusch=C3=A4fer?= Date: Mon, 18 Jul 2011 15:58:02 +0200 Subject: output/shout: fix a memory leak --- src/output/shout_plugin.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'src/output') diff --git a/src/output/shout_plugin.c b/src/output/shout_plugin.c index baaeccf92..5e1ef762a 100644 --- a/src/output/shout_plugin.c +++ b/src/output/shout_plugin.c @@ -152,7 +152,7 @@ my_shout_init_driver(const struct audio_format *audio_format, if (port == 0) { g_set_error(error, shout_output_quark(), 0, "shout port must be configured"); - return NULL; + goto failure; } check_block_param("password"); @@ -174,21 +174,21 @@ my_shout_init_driver(const struct audio_format *audio_format, "shout quality \"%s\" is not a number in the " "range -1 to 10, line %i", value, param->line); - return NULL; + goto failure; } if (config_get_block_string(param, "bitrate", NULL) != NULL) { g_set_error(error, shout_output_quark(), 0, "quality and bitrate are " "both defined"); - return NULL; + goto failure; } } else { value = config_get_block_string(param, "bitrate", NULL); if (value == NULL) { g_set_error(error, shout_output_quark(), 0, "neither bitrate nor quality defined"); - return NULL; + goto failure; } sd->bitrate = strtol(value, &test, 10); @@ -196,7 +196,7 @@ my_shout_init_driver(const struct audio_format *audio_format, if (*test != '\0' || sd->bitrate <= 0) { g_set_error(error, shout_output_quark(), 0, "bitrate must be a positive integer"); - return NULL; + goto failure; } } @@ -206,12 +206,12 @@ my_shout_init_driver(const struct audio_format *audio_format, g_set_error(error, shout_output_quark(), 0, "couldn't find shout encoder plugin \"%s\"", encoding); - return NULL; + goto failure; } sd->encoder = encoder_init(encoder_plugin, param, error); if (sd->encoder == NULL) - return NULL; + goto failure; if (strcmp(encoding, "mp3") == 0 || strcmp(encoding, "lame") == 0) shout_format = SHOUT_FORMAT_MP3; @@ -225,7 +225,7 @@ my_shout_init_driver(const struct audio_format *audio_format, g_set_error(error, shout_output_quark(), 0, "you cannot stream \"%s\" to shoutcast, use mp3", encoding); - return NULL; + goto failure; } else if (0 == strcmp(value, "shoutcast")) protocol = SHOUT_PROTOCOL_ICY; else if (0 == strcmp(value, "icecast1")) @@ -237,7 +237,7 @@ my_shout_init_driver(const struct audio_format *audio_format, "shout protocol \"%s\" is not \"shoutcast\" or " "\"icecast1\"or \"icecast2\"", value); - return NULL; + goto failure; } } else { protocol = SHOUT_PROTOCOL_HTTP; @@ -256,7 +256,7 @@ my_shout_init_driver(const struct audio_format *audio_format, shout_set_agent(sd->shout_conn, "MPD") != SHOUTERR_SUCCESS) { g_set_error(error, shout_output_quark(), 0, "%s", shout_get_error(sd->shout_conn)); - return NULL; + goto failure; } /* optional paramters */ @@ -267,14 +267,14 @@ my_shout_init_driver(const struct audio_format *audio_format, if (value != NULL && shout_set_genre(sd->shout_conn, value)) { g_set_error(error, shout_output_quark(), 0, "%s", shout_get_error(sd->shout_conn)); - return NULL; + goto failure; } value = config_get_block_string(param, "description", NULL); if (value != NULL && shout_set_description(sd->shout_conn, value)) { g_set_error(error, shout_output_quark(), 0, "%s", shout_get_error(sd->shout_conn)); - return NULL; + goto failure; } { @@ -300,6 +300,10 @@ my_shout_init_driver(const struct audio_format *audio_format, } return sd; + +failure: + free_shout_data(sd); + return NULL; } static bool -- cgit v1.2.3