[libgxps] Fixed memory leak when parsing a RenderTransform element fails



commit 82d3a0d61a29812a94a80769cb3f47ee49453329
Author: Jason Crain <jason aquaticape us>
Date:   Fri Dec 23 23:59:14 2011 -0600

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

 libgxps/gxps-matrix.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/libgxps/gxps-matrix.c b/libgxps/gxps-matrix.c
index ac0c5a1..9eb1fdc 100644
--- a/libgxps/gxps-matrix.c
+++ b/libgxps/gxps-matrix.c
@@ -112,11 +112,21 @@ matrix_start_element (GMarkupParseContext  *context,
         }
 }
 
+static void
+matrix_error (GMarkupParseContext *context,
+              GError              *error,
+              gpointer             user_data)
+{
+	GXPSMatrix *matrix = (GXPSMatrix *)user_data;
+	gxps_matrix_free (matrix);
+}
+
 static GMarkupParser matrix_parser = {
         matrix_start_element,
         NULL,
         NULL,
-        NULL
+        NULL,
+        matrix_error
 };
 
 void



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