[libgxps] Fixed memory leak when parsing a ImageBrush element fails
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgxps] Fixed memory leak when parsing a ImageBrush element fails
- Date: Mon, 30 Jan 2012 12:57:17 +0000 (UTC)
commit 2bb45e1566fb03bf3bb5fd3b9ad96eec54da9a2a
Author: Jason Crain <jason aquaticape us>
Date: Sun Jan 8 14:23:14 2012 -0600
Fixed memory leak when parsing a ImageBrush element fails
A GXPSBrushImage struct is leaked when parsing fails for a child
element of a ImageBrush. Parsing is aborted when invalid data is
encountered and cleanup code is not run. This adds a error handler to
the brush_image GMarkupParser to free the struct on error.
https://bugzilla.gnome.org/show_bug.cgi?id=668969
libgxps/gxps-brush.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/libgxps/gxps-brush.c b/libgxps/gxps-brush.c
index 1b4e00a..b573bd5 100644
--- a/libgxps/gxps-brush.c
+++ b/libgxps/gxps-brush.c
@@ -386,11 +386,21 @@ brush_image_end_element (GMarkupParseContext *context,
}
}
+static void
+brush_image_error (GMarkupParseContext *context,
+ GError *error,
+ gpointer user_data)
+{
+ GXPSBrushImage *image = (GXPSBrushImage *)user_data;
+ gxps_brush_image_free (image);
+}
+
static GMarkupParser brush_image_parser = {
brush_image_start_element,
brush_image_end_element,
NULL,
- NULL
+ NULL,
+ brush_image_error
};
static GXPSBrushVisual *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]