[libgxps] Fixed memory leak when parsing fails for a child element of a Canvas
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgxps] Fixed memory leak when parsing fails for a child element of a Canvas
- Date: Mon, 30 Jan 2012 12:57:32 +0000 (UTC)
commit bff39ad37b3c0624f7e95ba72867df99f2661134
Author: Jason Crain <jason aquaticape us>
Date: Fri Dec 23 23:50:44 2011 -0600
Fixed memory leak when parsing fails for a child element of a Canvas
A GXPSCanvas struct is leaked when parsing fails for a child element
of a Canvas. Parsing is aborted when invalid data is encountered and
cleanup code is not run. This adds a error handler to the canvas
GMarkupParser to free the struct on error.
https://bugzilla.gnome.org/show_bug.cgi?id=668965
libgxps/gxps-page.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/libgxps/gxps-page.c b/libgxps/gxps-page.c
index ea614b5..c1dfb7e 100644
--- a/libgxps/gxps-page.c
+++ b/libgxps/gxps-page.c
@@ -357,11 +357,21 @@ canvas_end_element (GMarkupParseContext *context,
}
}
+static void
+canvas_error (GMarkupParseContext *context,
+ GError *error,
+ gpointer user_data)
+{
+ GXPSCanvas *canvas = (GXPSCanvas *)user_data;
+ gxps_canvas_free (canvas);
+}
+
static GMarkupParser canvas_parser = {
canvas_start_element,
canvas_end_element,
NULL,
- NULL
+ NULL,
+ canvas_error
};
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]