commit 72b511245d8ba63475f779b9f491f0d78a79ae16
Author: Christophe Fergeau <[email protected]>
Date:   Sat Jul 25 17:35:55 2009 +0200

    pedantic commit to use xmlFree on libxml memory and g_free on glib mem

 tools/ipod-lockdown.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/tools/ipod-lockdown.c b/tools/ipod-lockdown.c
index c0163a8..8579253 100644
--- a/tools/ipod-lockdown.c
+++ b/tools/ipod-lockdown.c
@@ -24,12 +24,15 @@
 #endif
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <glib.h>
+#include <libxml/xmlmemory.h>
 
 #include <libiphone/libiphone.h>
 #include <libiphone/lockdown.h>
 
+
 extern char *read_sysinfo_extended_by_uuid (const char *uuid);
 
 char *
@@ -39,6 +42,7 @@ read_sysinfo_extended_by_uuid (const char *uuid)
        iphone_device_t device = NULL;
        iphone_error_t ret = IPHONE_E_UNKNOWN_ERROR;
        char *xml = NULL; char *str = NULL;
+       char *gxml;
        uint32_t xml_length = 0;
        plist_t value = NULL;
        plist_t global = NULL;
@@ -85,5 +89,15 @@ read_sysinfo_extended_by_uuid (const char *uuid)
        lockdownd_client_free(client);
        iphone_device_free(device);
 
-       return xml;
+       /* Jump through hoops since libxml will say to free mem it allocated
+        * with xmlFree while memory freed with g_free has to be allocated
+        * by glib.
+        */
+       if (xml != NULL) {
+               gxml = g_strdup(xml);
+               xmlFree(xml);
+       } else {
+               gxml = NULL;
+       }
+       return gxml;
 }

------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to