# HG changeset patch # User Richard Laager # Date 1144771176 0 # Node ID 095fd5936962120bfae22a3d7a66f0b85dfcf9d7 # Parent 78c2c6a462d70f69a0a18d963455018d72d896ba [gaim-migrate @ 16007] datallah committed this to CVS during the CVS -> SVN migration: The retval of xmlnode_get_data() needs to be g_free()'d committer: Tailor Script diff -r 78c2c6a462d7 -r 095fd5936962 src/upnp.c --- a/src/upnp.c Tue Apr 11 00:31:09 2006 +0000 +++ b/src/upnp.c Tue Apr 11 15:59:36 2006 +0000 @@ -169,11 +169,18 @@ gaim_upnp_compare_device(const xmlnode* device, const gchar* deviceType) { xmlnode* deviceTypeNode = xmlnode_get_child(device, "deviceType"); + char *tmp; + gboolean ret; + if(deviceTypeNode == NULL) { return FALSE; } - return !g_ascii_strcasecmp(xmlnode_get_data(deviceTypeNode), - deviceType); + + tmp = xmlnode_get_data(deviceTypeNode); + ret = !g_ascii_strcasecmp(tmp, deviceType); + g_free(tmp); + + return ret; } @@ -181,11 +188,18 @@ gaim_upnp_compare_service(const xmlnode* service, const gchar* serviceType) { xmlnode* serviceTypeNode = xmlnode_get_child(service, "serviceType"); + char *tmp; + gboolean ret; + if(serviceTypeNode == NULL) { return FALSE; } - return !g_ascii_strcasecmp(xmlnode_get_data(serviceTypeNode), - serviceType); + + tmp = xmlnode_get_data(serviceTypeNode); + ret = !g_ascii_strcasecmp(tmp, serviceType); + g_free(tmp); + + return ret; } @@ -193,14 +207,9 @@ gaim_upnp_parse_description_response(const gchar* httpResponse, gsize len, const gchar* httpURL, const gchar* serviceType) { - gchar* xmlRoot; - gchar* baseURL; - gchar* controlURL; - gchar* service; - xmlnode* xmlRootNode; - xmlnode* serviceTypeNode; - xmlnode* controlURLNode; - xmlnode* baseURLNode; + gchar *xmlRoot, *baseURL, *controlURL, *service; + xmlnode *xmlRootNode, *serviceTypeNode, *controlURLNode, *baseURLNode; + char *tmp; /* make sure we have a valid http response */ if(g_strstr_len(httpResponse, len, HTTP_OK) == NULL) { @@ -226,7 +235,7 @@ /* get the baseURL of the device */ if((baseURLNode = xmlnode_get_child(xmlRootNode, "URLBase")) != NULL) { - baseURL = g_strdup(xmlnode_get_data(baseURLNode)); + baseURL = xmlnode_get_data(baseURLNode); } else { baseURL = g_strdup(httpURL); } @@ -328,12 +337,13 @@ return NULL; } - if(!gaim_str_has_prefix(xmlnode_get_data(controlURLNode), "http://") && - !gaim_str_has_prefix(xmlnode_get_data(controlURLNode), "HTTP://")) { - controlURL = g_strdup_printf("%s%s", baseURL, - xmlnode_get_data(controlURLNode)); + tmp = xmlnode_get_data(controlURLNode); + if(!gaim_str_has_prefix(tmp, "http://") && + !gaim_str_has_prefix(tmp, "HTTP://")) { + controlURL = g_strdup_printf("%s%s", baseURL, tmp); + g_free(tmp); }else{ - controlURL = g_strdup(xmlnode_get_data(controlURLNode)); + controlURL = tmp; } g_free(baseURL); xmlnode_free(xmlRootNode);