Mercurial > pidgin
comparison src/protocols/msn/slp.c @ 12126:35c4797c5c57
[gaim-migrate @ 14426]
SF Patch #1359761, from sadrul
"This patch plugs some memory leaks in a few places
ragarding gaim_find_buddies. It also changes the call
to gaim_find_buddy in a couple of places that only
needs one buddy."
I also fixed a case of g_free()ing a const char * in the sametime prpl.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Fri, 18 Nov 2005 12:05:40 +0000 |
parents | a1aa681f1448 |
children | fc464a0abccc |
comparison
equal
deleted
inserted
replaced
12125:3c1bac709234 | 12126:35c4797c5c57 |
---|---|
846 static gboolean | 846 static gboolean |
847 buddy_icon_cached(GaimConnection *gc, MsnObject *obj) | 847 buddy_icon_cached(GaimConnection *gc, MsnObject *obj) |
848 { | 848 { |
849 GaimAccount *account; | 849 GaimAccount *account; |
850 GaimBuddy *buddy; | 850 GaimBuddy *buddy; |
851 GSList *sl; | |
852 const char *old; | 851 const char *old; |
853 const char *new; | 852 const char *new; |
854 | 853 |
855 g_return_val_if_fail(obj != NULL, FALSE); | 854 g_return_val_if_fail(obj != NULL, FALSE); |
856 | 855 |
857 account = gaim_connection_get_account(gc); | 856 account = gaim_connection_get_account(gc); |
858 | 857 |
859 sl = gaim_find_buddies(account, msn_object_get_creator(obj)); | 858 buddy = gaim_find_buddy(account, msn_object_get_creator(obj)); |
860 | 859 if (buddy == NULL) |
861 if (sl == NULL) | |
862 return FALSE; | 860 return FALSE; |
863 | |
864 buddy = (GaimBuddy *)sl->data; | |
865 | 861 |
866 old = gaim_blist_node_get_string((GaimBlistNode *)buddy, "icon_checksum"); | 862 old = gaim_blist_node_get_string((GaimBlistNode *)buddy, "icon_checksum"); |
867 new = msn_object_get_sha1c(obj); | 863 new = msn_object_get_sha1c(obj); |
868 | 864 |
869 if (new == NULL) | 865 if (new == NULL) |
928 obj = msn_user_get_object(user); | 924 obj = msn_user_get_object(user); |
929 | 925 |
930 if (obj == NULL) | 926 if (obj == NULL) |
931 { | 927 { |
932 /* It seems the user has not set a msnobject */ | 928 /* It seems the user has not set a msnobject */ |
933 GSList *sl; | 929 GSList *sl, *list; |
934 | 930 |
935 /* TODO: I think we need better buddy icon core functions. */ | 931 /* TODO: I think we need better buddy icon core functions. */ |
936 gaim_buddy_icons_set_for_user(account, user->passport, NULL, -1); | 932 gaim_buddy_icons_set_for_user(account, user->passport, NULL, -1); |
937 | 933 |
938 sl = gaim_find_buddies(account, user->passport); | 934 list = gaim_find_buddies(account, user->passport); |
939 | 935 |
940 for (; sl != NULL; sl = sl->next) | 936 for (sl = list; sl != NULL; sl = sl->next) |
941 { | 937 { |
942 GaimBuddy *buddy = (GaimBuddy *)sl->data; | 938 GaimBuddy *buddy = (GaimBuddy *)sl->data; |
943 gaim_blist_node_remove_setting((GaimBlistNode*)buddy, "icon_checksum"); | 939 gaim_blist_node_remove_setting((GaimBlistNode*)buddy, "icon_checksum"); |
944 } | 940 } |
941 g_slist_free(list); | |
945 | 942 |
946 return; | 943 return; |
947 } | 944 } |
948 | 945 |
949 if (!buddy_icon_cached(account->gc, obj)) | 946 if (!buddy_icon_cached(account->gc, obj)) |
975 const guchar *data, gsize size) | 972 const guchar *data, gsize size) |
976 { | 973 { |
977 MsnUserList *userlist; | 974 MsnUserList *userlist; |
978 const char *info; | 975 const char *info; |
979 GaimAccount *account; | 976 GaimAccount *account; |
980 GSList *sl; | 977 GSList *sl, *list; |
981 | 978 |
982 g_return_if_fail(slpcall != NULL); | 979 g_return_if_fail(slpcall != NULL); |
983 | 980 |
984 info = slpcall->data_info; | 981 info = slpcall->data_info; |
985 #ifdef MSN_DEBUG_UD | 982 #ifdef MSN_DEBUG_UD |
991 | 988 |
992 /* TODO: I think we need better buddy icon core functions. */ | 989 /* TODO: I think we need better buddy icon core functions. */ |
993 gaim_buddy_icons_set_for_user(account, slpcall->slplink->remote_user, | 990 gaim_buddy_icons_set_for_user(account, slpcall->slplink->remote_user, |
994 (void *)data, size); | 991 (void *)data, size); |
995 | 992 |
996 sl = gaim_find_buddies(account, slpcall->slplink->remote_user); | 993 list = gaim_find_buddies(account, slpcall->slplink->remote_user); |
997 | 994 |
998 for (; sl != NULL; sl = sl->next) | 995 for (sl = list; sl != NULL; sl = sl->next) |
999 { | 996 { |
1000 GaimBuddy *buddy = (GaimBuddy *)sl->data; | 997 GaimBuddy *buddy = (GaimBuddy *)sl->data; |
1001 gaim_blist_node_set_string((GaimBlistNode*)buddy, "icon_checksum", info); | 998 gaim_blist_node_set_string((GaimBlistNode*)buddy, "icon_checksum", info); |
1002 } | 999 } |
1000 g_slist_free(list); | |
1003 | 1001 |
1004 #if 0 | 1002 #if 0 |
1005 /* Free one window slot */ | 1003 /* Free one window slot */ |
1006 userlist->buddy_icon_window++; | 1004 userlist->buddy_icon_window++; |
1007 | 1005 |
1073 MsnObject *my_obj = NULL; | 1071 MsnObject *my_obj = NULL; |
1074 const char *filename = NULL; | 1072 const char *filename = NULL; |
1075 gchar *data = NULL; | 1073 gchar *data = NULL; |
1076 gsize len = 0; | 1074 gsize len = 0; |
1077 const char *my_info = NULL; | 1075 const char *my_info = NULL; |
1078 GSList *sl; | 1076 GSList *sl, *list; |
1079 | 1077 |
1080 #ifdef MSN_DEBUG_UD | 1078 #ifdef MSN_DEBUG_UD |
1081 gaim_debug_info("msn", "Requesting our own user display\n"); | 1079 gaim_debug_info("msn", "Requesting our own user display\n"); |
1082 #endif | 1080 #endif |
1083 | 1081 |
1094 | 1092 |
1095 /* TODO: I think we need better buddy icon core functions. */ | 1093 /* TODO: I think we need better buddy icon core functions. */ |
1096 gaim_buddy_icons_set_for_user(account, user->passport, (void *)data, len); | 1094 gaim_buddy_icons_set_for_user(account, user->passport, (void *)data, len); |
1097 g_free(data); | 1095 g_free(data); |
1098 | 1096 |
1099 sl = gaim_find_buddies(account, user->passport); | 1097 list = gaim_find_buddies(account, user->passport); |
1100 | 1098 |
1101 for (; sl != NULL; sl = sl->next) | 1099 for (sl = list; sl != NULL; sl = sl->next) |
1102 { | 1100 { |
1103 GaimBuddy *buddy = (GaimBuddy *)sl->data; | 1101 GaimBuddy *buddy = (GaimBuddy *)sl->data; |
1104 gaim_blist_node_set_string((GaimBlistNode*)buddy, "icon_checksum", info); | 1102 gaim_blist_node_set_string((GaimBlistNode*)buddy, "icon_checksum", info); |
1105 } | 1103 } |
1104 g_slist_free(list); | |
1106 | 1105 |
1107 /* Free one window slot */ | 1106 /* Free one window slot */ |
1108 session->userlist->buddy_icon_window++; | 1107 session->userlist->buddy_icon_window++; |
1109 | 1108 |
1110 #ifdef MSN_DEBUG_UD | 1109 #ifdef MSN_DEBUG_UD |