minfoprovider: Fixed memory leaks
authorSimón Pena <spenap@gmail.com>
Fri, 4 Jun 2010 18:04:08 +0000 (20:04 +0200)
committerSimón Pena <spenap@gmail.com>
Sat, 5 Jun 2010 22:41:49 +0000 (00:41 +0200)
Fixed a couple of memory leaks in the response_received_cb,
when parsing the XML.

src/mvs-minfo-provider.c

index af1fdf9..4cb405a 100644 (file)
@@ -152,9 +152,10 @@ create_tmdb_movie (xmlNodePtr node)
         /* We use the loop to append each property to the movie object */
         for (cur_node = node; cur_node; cur_node = cur_node->next) {
                 if (cur_node->type == XML_ELEMENT_NODE) {
-                        const gchar *value = xmlNodeGetContent (cur_node);
+                        gchar *value = xmlNodeGetContent (cur_node);
 
                         g_object_set (movie_info, cur_node->name, value, NULL);
+                        g_free (value);
                 }
         }
         return movie_info;
@@ -203,7 +204,7 @@ parse_xml (const char *xml_data, goffset length)
                 list = generate_list (nodeset);
         }
 
-        xmlXPathFreeNodeSetList (xpath_obj);
+        xmlXPathFreeObject (xpath_obj);
         xmlXPathFreeContext (context_ptr);
         xmlFreeDoc (document);
 
@@ -295,8 +296,6 @@ process_response_cb (SoupSession *session, SoupMessage *message,
         }
 
         g_signal_emit (self, signals[RESPONSE_RECEIVED], 0, list);
-
-        g_list_free (list);
 }
 
 static gchar *