diff libpurple/protocols/msn/notification.c @ 28720:6a23d7f84143

Allow setting a destroy-function for the data. Fixes a leak.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Fri, 09 Oct 2009 18:01:51 +0000
parents 33856dfb5cbf
children 7f80b0fc825d d213c8ad89da
line wrap: on
line diff
--- a/libpurple/protocols/msn/notification.c	Fri Oct 09 17:33:16 2009 +0000
+++ b/libpurple/protocols/msn/notification.c	Fri Oct 09 18:01:51 2009 +0000
@@ -582,7 +582,8 @@
 
 	trans = msn_transaction_new(cmdproc, "FQY", "%d", payload_len);
 	msn_transaction_set_payload(trans, payload, payload_len);
-	msn_transaction_set_data(trans, data);	/* XXX: 'data' leaks */
+	msn_transaction_set_data(trans, data);
+	msn_transaction_set_data_free(trans, g_free);
 	msn_cmdproc_send_trans(cmdproc, trans);
 }
 
@@ -962,9 +963,8 @@
 			if (cmd->trans->data) {
 				MsnFqyCbData *fqy_data = cmd->trans->data;
 				fqy_data->cb(session, passport, network, fqy_data->data);
-				/* TODO: This leaks, but the server responds to FQY multiple times, so we
-				         can't free it yet. We need to figure out somewhere else to do so.
-				g_free(fqy_data); */
+				/* Don't free fqy_data yet since the server responds to FQY multipe times.
+				   It will be freed when cmd->trans is freed. */
 			}
 
 			g_free(passport);