Mercurial > pidgin
comparison libpurple/protocols/silc/silc.c @ 22824:67a4c8c46f78
Cleanup allocations/frees to match and plug some leaks.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Sat, 03 May 2008 07:13:58 +0000 |
parents | a666d3e7447f |
children | 1008901e1d5c 8c3444f04709 |
comparison
equal
deleted
inserted
replaced
22823:fc1e708ddf92 | 22824:67a4c8c46f78 |
---|---|
573 if (!purple_account_get_username(account)) | 573 if (!purple_account_get_username(account)) |
574 purple_account_set_username(account, silc_get_username()); | 574 purple_account_set_username(account, silc_get_username()); |
575 | 575 |
576 username = (char *)purple_account_get_username(account); | 576 username = (char *)purple_account_get_username(account); |
577 up = g_strsplit(username, "@", 2); | 577 up = g_strsplit(username, "@", 2); |
578 username = strdup(up[0]); | 578 username = g_strdup(up[0]); |
579 g_strfreev(up); | 579 g_strfreev(up); |
580 | 580 |
581 if (!purple_account_get_user_info(account)) { | 581 if (!purple_account_get_user_info(account)) { |
582 purple_account_set_user_info(account, silc_get_real_name()); | 582 purple_account_set_user_info(account, silc_get_real_name()); |
583 if (!purple_account_get_user_info(account)) | 583 if (!purple_account_get_user_info(account)) |
617 silcpurple_running, sg)) { | 617 silcpurple_running, sg)) { |
618 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, | 618 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, |
619 _("Cannot initialize SILC protocol")); | 619 _("Cannot initialize SILC protocol")); |
620 gc->proto_data = NULL; | 620 gc->proto_data = NULL; |
621 silc_free(sg); | 621 silc_free(sg); |
622 free(hostname); | 622 silc_free(hostname); |
623 free(username); | 623 g_free(username); |
624 return; | 624 return; |
625 } | 625 } |
626 free(hostname); | 626 silc_free(hostname); |
627 free(username); | 627 g_free(username); |
628 | 628 |
629 /* Check the ~/.silc dir and create it, and new key pair if necessary. */ | 629 /* Check the ~/.silc dir and create it, and new key pair if necessary. */ |
630 if (!silcpurple_check_silc_dir(gc)) { | 630 if (!silcpurple_check_silc_dir(gc)) { |
631 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, | 631 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, |
632 _("Error loading SILC key pair")); | 632 _("Error loading SILC key pair")); |
2109 NULL, | 2109 NULL, |
2110 NULL, | 2110 NULL, |
2111 NULL | 2111 NULL |
2112 }; | 2112 }; |
2113 | 2113 |
2114 #if 0 | |
2115 static SilcBool silcpurple_debug_cb(char *file, char *function, int line, | |
2116 char *message, void *context) | |
2117 { | |
2118 purple_debug_info("SILC", "%s:%d:%s - %s\n", file ? file : "(null)", line, function ? function : "(null)", message ? message : "(null)"); | |
2119 return TRUE; | |
2120 } | |
2121 #endif | |
2122 | |
2114 static void | 2123 static void |
2115 init_plugin(PurplePlugin *plugin) | 2124 init_plugin(PurplePlugin *plugin) |
2116 { | 2125 { |
2117 PurpleAccountOption *option; | 2126 PurpleAccountOption *option; |
2118 PurpleAccountUserSplit *split; | 2127 PurpleAccountUserSplit *split; |
2187 silcpurple_register_commands(); | 2196 silcpurple_register_commands(); |
2188 | 2197 |
2189 #if 0 | 2198 #if 0 |
2190 silc_log_debug(TRUE); | 2199 silc_log_debug(TRUE); |
2191 silc_log_set_debug_string("*client*"); | 2200 silc_log_set_debug_string("*client*"); |
2201 silc_log_quick(TRUE); | |
2202 silc_log_set_debug_callbacks(silcpurple_debug_cb, NULL, NULL, NULL); | |
2192 #endif | 2203 #endif |
2193 | 2204 |
2194 } | 2205 } |
2195 | 2206 |
2196 PURPLE_INIT_PLUGIN(silc, init_plugin, info); | 2207 PURPLE_INIT_PLUGIN(silc, init_plugin, info); |