[grilo-plugins] lua-factory: Fix memory leak fetching ISO8859-1 text
- From: Victor Toso de Carvalho <victortoso src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] lua-factory: Fix memory leak fetching ISO8859-1 text
- Date: Mon, 27 Jul 2015 12:23:10 +0000 (UTC)
commit 57b345fbf40cd744f37246671df189b6d99144ce
Author: Bastien Nocera <hadess hadess net>
Date: Mon Jul 27 13:00:41 2015 +0200
lua-factory: Fix memory leak fetching ISO8859-1 text
Fix memory leak introduced in e064a170316e2a737d0625720b706e4c08bae6e6
when the text downloaded is actually in ISO8859-1 format.
https://bugzilla.gnome.org/show_bug.cgi?id=752895
src/lua-factory/grl-lua-library.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/src/lua-factory/grl-lua-library.c b/src/lua-factory/grl-lua-library.c
index fb6094b..1023254 100644
--- a/src/lua-factory/grl-lua-library.c
+++ b/src/lua-factory/grl-lua-library.c
@@ -450,12 +450,12 @@ grl_util_fetch_done (GObject *source_object,
OperationSpec *os;
FetchOperation *fo = (FetchOperation *) user_data;
lua_State *L = fo->L;
+ gchar *fixed = NULL;
if (!grl_net_wc_request_finish (GRL_NET_WC (source_object),
res, &data, &len, &err)) {
data = NULL;
} else if (!g_utf8_validate(data, len, NULL)) {
- char *fixed;
fixed = g_convert (data, len, "UTF-8", "ISO8859-1", NULL, NULL, NULL);
if (!fixed) {
g_set_error_literal (&err, G_IO_ERROR, G_IO_ERROR_INVALID_DATA,
@@ -467,6 +467,8 @@ grl_util_fetch_done (GObject *source_object,
}
fo->results[fo->index] = (err == NULL) ? g_strdup (data) : g_strdup ("");
+ g_free (fixed);
+
if (err != NULL) {
GRL_WARNING ("Can't fetch element %d (URL: %s): '%s'", fo->index + 1, fo->url, err->message);
g_error_free (err);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]