[libgxps] Fixed memory leak when parsing fails for a child element of a Path



commit ca12aae0e8fd69b5774b0ff69138957340eb2ff7
Author: Jason Crain <jason aquaticape us>
Date:   Sat Jan 28 16:50:23 2012 -0600

    Fixed memory leak when parsing fails for a child element of a Path
    
    A GXPSPath struct is leaked when parsing fails for a child element of
    a Path.  Parsing is aborted when invalid data is encountered and
    cleanup code is not run.  This adds a error handler to the path
    GMarkupParser to free the struct on error.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=668940

 libgxps/gxps-path.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/libgxps/gxps-path.c b/libgxps/gxps-path.c
index 80d53f4..90a9103 100644
--- a/libgxps/gxps-path.c
+++ b/libgxps/gxps-path.c
@@ -1051,11 +1051,21 @@ path_end_element (GMarkupParseContext  *context,
 	}
 }
 
+static void
+path_error (GMarkupParseContext *context,
+	    GError              *error,
+	    gpointer             user_data)
+{
+	GXPSPath *path = (GXPSPath *)user_data;
+	gxps_path_free (path);
+}
+
 static GMarkupParser path_parser = {
         path_start_element,
         path_end_element,
         NULL,
-        NULL
+        NULL,
+        path_error
 };
 
 void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]