# HG changeset patch
# Node ID 0dc755e9cd86
# Parent  26b5ad3db41b
diff --git a/finch/plugins/gnttinyurl/gnttinyurl.c b/finch/plugins/gnttinyurl/gnttinyurl.c
--- a/finch/plugins/gnttinyurl/gnttinyurl.c
+++ b/finch/plugins/gnttinyurl/gnttinyurl.c
@@ -233,10 +233,12 @@ url_fetched(GObject *source, GAsyncResul
 		gnt_text_view_tag_change(tv, data->tag, str, FALSE);
 		g_free(str);
 		g_free(data->tag);
+		g_object_unref(data->msg);
 		g_free(data);
 		return;
 	}
 	g_free(data->tag);
+	g_object_unref(data->msg);
 	g_free(data);
 	purple_debug_info("TinyURL", "Conversation no longer exists... :(\n");
 }
@@ -409,6 +411,7 @@ tinyurl_notify_fetch_cb(GObject *source,
 	}
 
 	if (response_body == NULL) {
+		g_object_unref(msg);
 		return;
 	}
 
@@ -421,6 +424,7 @@ tinyurl_notify_fetch_cb(GObject *source,
 	tinyurl_notify_tinyuri(win, url);
 
 	g_bytes_unref(response_body);
+	g_object_unref(msg);
 }
 
 static void *
@@ -473,7 +477,7 @@ tinyurl_notify_uri(const char *uri)
 	                       g_free);
 
 	soup_session_send_and_read_async(session, msg, G_PRIORITY_DEFAULT,
-	                                 cancellable, tinyurl_notify_fetch_cb, win);
+	                                 cancellable, tinyurl_notify_fetch_cb, msg);
 	g_signal_connect_object(win, "destroy", G_CALLBACK(g_cancellable_cancel),
 	                        cancellable, G_CONNECT_SWAPPED);
 	g_free(fullurl);
diff --git a/libpurple/protocols/facebook/api.c b/libpurple/protocols/facebook/api.c
--- a/libpurple/protocols/facebook/api.c
+++ b/libpurple/protocols/facebook/api.c
@@ -798,6 +798,7 @@ fb_api_cb_http_bool(GObject *source, GAs
 	JsonNode *root;
 
 	if (!fb_api_http_chk(api, session, result, soupmsg, &root)) {
+		g_object_unref(soupmsg);
 		return;
 	}
 
@@ -807,6 +808,7 @@ fb_api_cb_http_bool(GObject *source, GAs
 	}
 
 	json_node_free(root);
+	g_object_unref(soupmsg);
 }
 
 static void
@@ -989,6 +991,7 @@ fb_api_cb_seqid(GObject *source, GAsyncR
 	JsonNode *root;
 
 	if (!fb_api_http_chk(api, session, result, soupmsg, &root)) {
+		g_object_unref(soupmsg);
 		return;
 	}
 
@@ -1002,6 +1005,7 @@ fb_api_cb_seqid(GObject *source, GAsyncR
 	FB_API_ERROR_EMIT(api, err,
 		g_object_unref(values);
 		json_node_free(root);
+		g_object_unref(soupmsg);
 		return;
 	);
 
@@ -1018,6 +1022,7 @@ fb_api_cb_seqid(GObject *source, GAsyncR
 
 	g_object_unref(values);
 	json_node_free(root);
+	g_object_unref(soupmsg);
 }
 
 static void
@@ -2022,6 +2027,7 @@ fb_api_cb_attach(GObject *source, GAsync
 	static const gchar *imgexts[] = {".jpg", ".png", ".gif"};
 
 	if (!fb_api_http_chk(api, session, result, soupmsg, &root)) {
+		g_object_unref(soupmsg);
 		return;
 	}
 
@@ -2033,6 +2039,7 @@ fb_api_cb_attach(GObject *source, GAsync
 	FB_API_ERROR_EMIT(api, err,
 		g_object_unref(values);
 		json_node_free(root);
+		g_object_unref(soupmsg);
 		return;
 	);
 
@@ -2055,7 +2062,7 @@ fb_api_cb_attach(GObject *source, GAsync
 	g_slist_free_full(msgs, (GDestroyNotify) fb_api_message_free);
 	g_object_unref(values);
 	json_node_free(root);
-
+	g_object_unref(soupmsg);
 }
 
 static void
@@ -2070,7 +2077,7 @@ fb_api_attach(FbApi *api, FbId aid, cons
 
 	http = fb_api_http_req(api, FB_API_URL_ATTACH, "getAttachment",
 	                       "messaging.getAttachment", prms,
-			       fb_api_cb_attach);
+	                       fb_api_cb_attach);
 	g_object_set_data_full(G_OBJECT(http), "fb-api-msg", msg,
 	                       (GDestroyNotify)fb_api_message_free);
 }
@@ -2085,6 +2092,7 @@ fb_api_cb_auth(GObject *source, GAsyncRe
 	JsonNode *root;
 
 	if (!fb_api_http_chk(api, session, result, soupmsg, &root)) {
+		g_object_unref(soupmsg);
 		return;
 	}
 
@@ -2096,6 +2104,7 @@ fb_api_cb_auth(GObject *source, GAsyncRe
 	FB_API_ERROR_EMIT(api, err,
 		g_object_unref(values);
 		json_node_free(root);
+		g_object_unref(soupmsg);
 		return;
 	);
 
@@ -2106,6 +2115,7 @@ fb_api_cb_auth(GObject *source, GAsyncRe
 	g_signal_emit_by_name(api, "auth");
 	g_object_unref(values);
 	json_node_free(root);
+	g_object_unref(soupmsg);
 }
 
 void
@@ -2155,6 +2165,7 @@ fb_api_cb_contact(GObject *source, GAsyn
 	JsonNode *root;
 
 	if (!fb_api_http_chk(api, session, result, soupmsg, &root)) {
+		g_object_unref(soupmsg);
 		return;
 	}
 
@@ -2164,6 +2175,7 @@ fb_api_cb_contact(GObject *source, GAsyn
 		fb_api_error_literal(api, FB_API_ERROR_GENERAL,
 		                     _("Failed to obtain contact information"));
 		json_node_free(root);
+		g_object_unref(soupmsg);
 		return;
 	}
 
@@ -2177,6 +2189,7 @@ fb_api_cb_contact(GObject *source, GAsyn
 	FB_API_ERROR_EMIT(api, err,
 		g_object_unref(values);
 		json_node_free(root);
+		g_object_unref(soupmsg);
 		return;
 	);
 
@@ -2192,6 +2205,7 @@ fb_api_cb_contact(GObject *source, GAsyn
 	fb_api_user_reset(&user, TRUE);
 	g_object_unref(values);
 	json_node_free(root);
+	g_object_unref(soupmsg);
 }
 
 void
@@ -2312,6 +2326,7 @@ fb_api_cb_contacts(GObject *source, GAsy
 	JsonNode *node;
 
 	if (!fb_api_http_chk(api, session, result, soupmsg, &root)) {
+		g_object_unref(soupmsg);
 		return;
 	}
 
@@ -2388,6 +2403,7 @@ fb_api_cb_contacts(GObject *source, GAsy
 
 	json_node_free(croot);
 	json_node_free(root);
+	g_object_unref(soupmsg);
 }
 
 void
@@ -2626,6 +2642,7 @@ fb_api_cb_unread_msgs(GObject *source, G
 	JsonNode *xode;
 
 	if (!fb_api_http_chk(api, session, result, soupmsg, &root)) {
+		g_object_unref(soupmsg);
 		return;
 	}
 
@@ -2635,6 +2652,7 @@ fb_api_cb_unread_msgs(GObject *source, G
 		fb_api_error_literal(api, FB_API_ERROR_GENERAL,
 		                     _("Failed to obtain unread messages"));
 		json_node_free(root);
+		g_object_unref(soupmsg);
 		return;
 	}
 
@@ -2645,6 +2663,7 @@ fb_api_cb_unread_msgs(GObject *source, G
 
 	FB_API_ERROR_EMIT(api, err,
 		g_object_unref(values);
+		g_object_unref(soupmsg);
 		return;
 	);
 
@@ -2736,6 +2755,7 @@ fb_api_cb_unread_msgs(GObject *source, G
 	g_slist_free_full(msgs, (GDestroyNotify) fb_api_message_free);
 	g_object_unref(values);
 	json_node_free(root);
+	g_object_unref(soupmsg);
 }
 
 static void
@@ -2751,6 +2771,7 @@ fb_api_cb_unread(GObject *source, GAsync
 	JsonNode *root;
 
 	if (!fb_api_http_chk(api, session, result, soupmsg, &root)) {
+		g_object_unref(soupmsg);
 		return;
 	}
 
@@ -2795,6 +2816,7 @@ fb_api_cb_unread(GObject *source, GAsync
 
 	g_object_unref(values);
 	json_node_free(root);
+	g_object_unref(soupmsg);
 }
 
 void
@@ -2830,6 +2852,7 @@ fb_api_cb_sticker(GObject *source, GAsyn
 	JsonNode *root;
 
 	if (!fb_api_http_chk(api, session, result, soupmsg, &root)) {
+		g_object_unref(soupmsg);
 		return;
 	}
 
@@ -2842,6 +2865,7 @@ fb_api_cb_sticker(GObject *source, GAsyn
 	FB_API_ERROR_EMIT(api, err,
 		g_object_unref(values);
 		json_node_free(root);
+		g_object_unref(soupmsg);
 		return;
 	);
 
@@ -2854,6 +2878,7 @@ fb_api_cb_sticker(GObject *source, GAsyn
 	g_slist_free_full(msgs, (GDestroyNotify) fb_api_message_free);
 	g_object_unref(values);
 	json_node_free(root);
+	g_object_unref(soupmsg);
 }
 
 static void
@@ -2957,6 +2982,7 @@ fb_api_cb_thread(GObject *source, GAsync
 	JsonNode *root;
 
 	if (!fb_api_http_chk(api, session, result, soupmsg, &root)) {
+		g_object_unref(soupmsg);
 		return;
 	}
 
@@ -2966,6 +2992,7 @@ fb_api_cb_thread(GObject *source, GAsync
 		fb_api_error_literal(api, FB_API_ERROR_GENERAL,
 		                     _("Failed to obtain thread information"));
 		json_node_free(root);
+		g_object_unref(soupmsg);
 		return;
 	}
 
@@ -2988,6 +3015,7 @@ fb_api_cb_thread(GObject *source, GAsync
 
 	fb_api_thread_reset(&thrd, TRUE);
 	json_node_free(root);
+	g_object_unref(soupmsg);
 }
 
 void
@@ -3018,6 +3046,7 @@ fb_api_cb_thread_create(GObject *source,
 	JsonNode *root;
 
 	if (!fb_api_http_chk(api, session, result, soupmsg, &root)) {
+		g_object_unref(soupmsg);
 		return;
 	}
 
@@ -3028,6 +3057,7 @@ fb_api_cb_thread_create(GObject *source,
 	FB_API_ERROR_EMIT(api, err,
 		g_object_unref(values);
 		json_node_free(root);
+		g_object_unref(soupmsg);
 		return;
 	);
 
@@ -3037,6 +3067,7 @@ fb_api_cb_thread_create(GObject *source,
 
 	g_object_unref(values);
 	json_node_free(root);
+	g_object_unref(soupmsg);
 }
 
 void
@@ -3132,8 +3163,7 @@ fb_api_thread_topic(FbApi *api, FbId tid
 	fb_http_params_set_str(prms, "name", topic);
 	fb_http_params_set_int(prms, "tid", tid);
 	fb_api_http_req(api, FB_API_URL_TOPIC, "setThreadName",
-	                "messaging.setthreadname", prms,
-			fb_api_cb_http_bool);
+	                "messaging.setthreadname", prms, fb_api_cb_http_bool);
 }
 
 static void
@@ -3151,6 +3181,7 @@ fb_api_cb_threads(GObject *source, GAsyn
 	JsonNode *root;
 
 	if (!fb_api_http_chk(api, session, result, soupmsg, &root)) {
+		g_object_unref(soupmsg);
 		return;
 	}
 
@@ -3158,6 +3189,7 @@ fb_api_cb_threads(GObject *source, GAsyn
 	                           &err);
 	FB_API_ERROR_EMIT(api, err,
 		json_node_free(root);
+		g_object_unref(soupmsg);
 		return;
 	);
 
@@ -3189,6 +3221,7 @@ fb_api_cb_threads(GObject *source, GAsyn
 	g_list_free(elms);
 	json_array_unref(arr);
 	json_node_free(root);
+	g_object_unref(soupmsg);
 }
 
 void
diff --git a/libpurple/protocols/facebook/data.c b/libpurple/protocols/facebook/data.c
--- a/libpurple/protocols/facebook/data.c
+++ b/libpurple/protocols/facebook/data.c
@@ -511,6 +511,7 @@ fb_data_image_cb(GObject *source, GAsync
 	}
 
 	g_object_unref(img);
+	g_object_unref(msg);
 }
 
 void
diff --git a/libpurple/protocols/jabber/bosh.c b/libpurple/protocols/jabber/bosh.c
--- a/libpurple/protocols/jabber/bosh.c
+++ b/libpurple/protocols/jabber/bosh.c
@@ -252,6 +252,7 @@ jabber_bosh_connection_recv(GObject *sou
 	node = jabber_bosh_connection_parse(bosh_conn, msg, response_body, error);
 	g_clear_pointer(&response_body, g_bytes_unref);
 	g_clear_error(&error);
+	g_clear_object(&msg);
 
 	if (node == NULL) {
 		return;
@@ -436,6 +437,7 @@ jabber_bosh_connection_session_created(G
 	node = jabber_bosh_connection_parse(bosh_conn, msg, response_body, error);
 	g_clear_pointer(&response_body, g_bytes_unref);
 	g_clear_error(&error);
+	g_clear_object(&msg);
 
 	if (node == NULL) {
 		return;
diff --git a/libpurple/protocols/jabber/useravatar.c b/libpurple/protocols/jabber/useravatar.c
--- a/libpurple/protocols/jabber/useravatar.c
+++ b/libpurple/protocols/jabber/useravatar.c
@@ -244,6 +244,7 @@ do_buddy_avatar_update_fromurl(GObject *
 out:
 	g_free(info->from);
 	g_free(info->id);
+	g_object_unref(info->msg);
 	g_free(info);
 	g_clear_error(&error);
 }
