comparison libpurple/protocols/myspace/message.c @ 19256:34a1957de14b

Fix crashes. In myspace.c, clone the contact_info message before sending it to the callback function, and free it there. Also add a check to message.c to catch null element names, to somewhat prevent this mistake in the future.
author Jeffrey Connelly <jaconnel@calpoly.edu>
date Mon, 20 Aug 2007 02:35:32 +0000
parents 1ea47b06f1a6
children 3b7539c7402e
comparison
equal deleted inserted replaced
19255:1ea47b06f1a6 19256:34a1957de14b
1008 1008
1009 /* Linear search for the given name. O(n) but n is small. */ 1009 /* Linear search for the given name. O(n) but n is small. */
1010 for (node = msg; node != NULL; node = g_list_next(node)) { 1010 for (node = msg; node != NULL; node = g_list_next(node)) {
1011 MsimMessageElement *elem; 1011 MsimMessageElement *elem;
1012 1012
1013 elem = node->data; 1013 elem = (MsimMessageElement *)node->data;
1014
1014 g_return_val_if_fail(elem != NULL, NULL); 1015 g_return_val_if_fail(elem != NULL, NULL);
1016 g_return_val_if_fail(elem->name != NULL, NULL);
1015 1017
1016 if (strcmp(elem->name, name) == 0) { 1018 if (strcmp(elem->name, name) == 0) {
1017 return node; 1019 return node;
1018 } 1020 }
1019 } 1021 }