comparison libpurple/protocols/msn/notification.c @ 28353: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
comparison
equal deleted inserted replaced
28352:3061a0c72b26 28353:6a23d7f84143
580 data->cb = cb; 580 data->cb = cb;
581 data->data = cb_data; 581 data->data = cb_data;
582 582
583 trans = msn_transaction_new(cmdproc, "FQY", "%d", payload_len); 583 trans = msn_transaction_new(cmdproc, "FQY", "%d", payload_len);
584 msn_transaction_set_payload(trans, payload, payload_len); 584 msn_transaction_set_payload(trans, payload, payload_len);
585 msn_transaction_set_data(trans, data); /* XXX: 'data' leaks */ 585 msn_transaction_set_data(trans, data);
586 msn_transaction_set_data_free(trans, g_free);
586 msn_cmdproc_send_trans(cmdproc, trans); 587 msn_cmdproc_send_trans(cmdproc, trans);
587 } 588 }
588 589
589 static void 590 static void
590 update_contact_network(MsnSession *session, const char *passport, MsnNetwork network, gpointer unused) 591 update_contact_network(MsnSession *session, const char *passport, MsnNetwork network, gpointer unused)
960 purple_debug_info("msn", "FQY response says %s is from network %d\n", 961 purple_debug_info("msn", "FQY response says %s is from network %d\n",
961 passport, network); 962 passport, network);
962 if (cmd->trans->data) { 963 if (cmd->trans->data) {
963 MsnFqyCbData *fqy_data = cmd->trans->data; 964 MsnFqyCbData *fqy_data = cmd->trans->data;
964 fqy_data->cb(session, passport, network, fqy_data->data); 965 fqy_data->cb(session, passport, network, fqy_data->data);
965 /* TODO: This leaks, but the server responds to FQY multiple times, so we 966 /* Don't free fqy_data yet since the server responds to FQY multipe times.
966 can't free it yet. We need to figure out somewhere else to do so. 967 It will be freed when cmd->trans is freed. */
967 g_free(fqy_data); */
968 } 968 }
969 969
970 g_free(passport); 970 g_free(passport);
971 } 971 }
972 } 972 }