From: "Richard W.M. Jones" <rjo...@redhat.com> (cherry picked from commit 0e1ba00059b5ebbca2e137f2685b2eb65ed33b13) (cherry picked from commit acba583d18644bb0bb120f5c2302254c65d981dc) --- src/cleanup.c | 10 ++++++++++ src/guestfs-internal-frontend.h | 4 ++++ 2 files changed, 14 insertions(+)
diff --git a/src/cleanup.c b/src/cleanup.c index 000ce5e..ef2e8ed 100644 --- a/src/cleanup.c +++ b/src/cleanup.c @@ -24,6 +24,7 @@ #include <string.h> #ifdef HAVE_LIBXML2 +#include <libxml/uri.h> #include <libxml/tree.h> #include <libxml/xpath.h> #include <libxml/xmlwriter.h> @@ -97,6 +98,15 @@ guestfs___cleanup_xmlFreeDoc (void *ptr) } void +guestfs___cleanup_xmlFreeURI (void *ptr) +{ + xmlURIPtr uri = * (xmlURIPtr *) ptr; + + if (uri) + xmlFreeURI (uri); +} + +void guestfs___cleanup_xmlFreeTextWriter (void *ptr) { #ifdef HAVE_LIBXML2 diff --git a/src/guestfs-internal-frontend.h b/src/guestfs-internal-frontend.h index 85594be..e4bf50c 100644 --- a/src/guestfs-internal-frontend.h +++ b/src/guestfs-internal-frontend.h @@ -47,6 +47,8 @@ __attribute__((cleanup(guestfs___cleanup_xmlBufferFree))) #define CLEANUP_XMLFREEDOC \ __attribute__((cleanup(guestfs___cleanup_xmlFreeDoc))) +#define CLEANUP_XMLFREEURI \ + __attribute__((cleanup(guestfs___cleanup_xmlFreeURI))) #define CLEANUP_XMLFREETEXTWRITER \ __attribute__((cleanup(guestfs___cleanup_xmlFreeTextWriter))) #define CLEANUP_XMLXPATHFREECONTEXT \ @@ -60,6 +62,7 @@ #define CLEANUP_UNLINK_FREE #define CLEANUP_XMLBUFFERFREE #define CLEANUP_XMLFREEDOC +#define CLEANUP_XMLFREEURI #define CLEANUP_XMLFREETEXTWRITER #define CLEANUP_XMLXPATHFREECONTEXT #define CLEANUP_XMLXPATHFREEOBJECT @@ -102,6 +105,7 @@ extern void guestfs___cleanup_hash_free (void *ptr); extern void guestfs___cleanup_unlink_free (void *ptr); extern void guestfs___cleanup_xmlBufferFree (void *ptr); extern void guestfs___cleanup_xmlFreeDoc (void *ptr); +extern void guestfs___cleanup_xmlFreeURI (void *ptr); extern void guestfs___cleanup_xmlFreeTextWriter (void *ptr); extern void guestfs___cleanup_xmlXPathFreeContext (void *ptr); extern void guestfs___cleanup_xmlXPathFreeObject (void *ptr); -- 1.8.3.1 _______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://www.redhat.com/mailman/listinfo/libguestfs