summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Alan Fitton <ajf@eth0.org.uk>2011-05-02 10:19:27 +0000
committerGravatar Alan Fitton <ajf@eth0.org.uk>2011-05-02 10:19:27 +0000
commit4707e5f94ebcb702cc90af38dcd6487d603899b9 (patch)
tree68f4c09a4661ab7d4499168b4ae832d7e295354d /src
parent4783c442c1811a8004bebaff9eea326fdd731ac9 (diff)
fix small list memory leak when a torrent is removed in active-only mode
Diffstat (limited to 'src')
-rw-r--r--src/trg-main-window.c3
-rw-r--r--src/trg-torrent-model.c5
2 files changed, 5 insertions, 3 deletions
diff --git a/src/trg-main-window.c b/src/trg-main-window.c
index e3eb0fd..4ee9d8b 100644
--- a/src/trg-main-window.c
+++ b/src/trg-main-window.c
@@ -368,7 +368,7 @@ destroy_window(GtkWidget * w G_GNUC_UNUSED, gpointer data G_GNUC_UNUSED)
gtk_main_quit();
}
-static void open_props_cb(GtkWidget * w, gpointer data)
+static void open_props_cb(GtkWidget * w G_GNUC_UNUSED, gpointer data)
{
TrgMainWindowPrivate *priv = TRG_MAIN_WINDOW_GET_PRIVATE(data);
TrgTorrentPropsDialog *dialog =
@@ -898,6 +898,7 @@ TRANSMISSION_MIN_SUPPORTED, version);
/*
* The callback for a torrent-get response.
*/
+
static void
on_torrent_get(JsonObject * response, int mode, int status, gpointer data)
{
diff --git a/src/trg-torrent-model.c b/src/trg-torrent-model.c
index c38b68e..d35e908 100644
--- a/src/trg-torrent-model.c
+++ b/src/trg-torrent-model.c
@@ -513,12 +513,13 @@ void trg_torrent_model_update(TrgTorrentModel * model, trg_client * tc,
} else if (mode > TORRENT_GET_MODE_FIRST) {
removedTorrents = get_torrents_removed(args);
if (removedTorrents) {
- for (li = json_array_get_elements(removedTorrents); li != NULL;
- li = g_list_next(li)) {
+ GList *hitlist = json_array_get_elements(removedTorrents);
+ for (li = hitlist; li; li = g_list_next(li)) {
id = json_node_get_int((JsonNode *) li->data);
g_hash_table_remove(priv->ht, &id);
addRemove = TRUE;
}
+ g_list_free(hitlist);
}
}