[libgxps] Fixed memory leak when parsing a Path attribute fails
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgxps] Fixed memory leak when parsing a Path attribute fails
- Date: Sun, 29 Jan 2012 14:08:33 +0000 (UTC)
commit e2bad1211d0790e7d05ebb6f83da3572d95c3a56
Author: Jason Crain <jason aquaticape us>
Date: Fri Dec 23 23:25:13 2011 -0600
Fixed memory leak when parsing a Path attribute fails
Fixed leak where a GXPSPath struct is leaked when a XPS document
contains a Path element with invalid attributes.
For example:
<Path Stroke="asdf" />
<Path Fill="asdf" />
...etc
This patch calls gxps_path_free in more code paths.
https://bugzilla.gnome.org/show_bug.cgi?id=668937
libgxps/gxps-page.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/libgxps/gxps-page.c b/libgxps/gxps-page.c
index dd8e824..ea614b5 100644
--- a/libgxps/gxps-page.c
+++ b/libgxps/gxps-page.c
@@ -394,6 +394,7 @@ render_start_element (GMarkupParseContext *context,
ctx->page->priv->source,
G_MARKUP_ERROR_INVALID_CONTENT,
"Path", "RenderTransform", values[i], error);
+ gxps_path_free (path);
return;
}
GXPS_DEBUG (g_message ("transform (%f, %f, %f, %f) [%f, %f]",
@@ -410,6 +411,7 @@ render_start_element (GMarkupParseContext *context,
ctx->page->priv->source,
G_MARKUP_ERROR_INVALID_CONTENT,
"Path", "Fill", values[i], error);
+ gxps_path_free (path);
return;
}
} else if (strcmp (names[i], "Stroke") == 0) {
@@ -419,6 +421,7 @@ render_start_element (GMarkupParseContext *context,
ctx->page->priv->source,
G_MARKUP_ERROR_INVALID_CONTENT,
"Path", "Stroke", values[i], error);
+ gxps_path_free (path);
return;
}
} else if (strcmp (names[i], "StrokeThickness") == 0) {
@@ -427,6 +430,7 @@ render_start_element (GMarkupParseContext *context,
ctx->page->priv->source,
G_MARKUP_ERROR_INVALID_CONTENT,
"Path", "StrokeThickness", values[i], error);
+ gxps_path_free (path);
return;
}
GXPS_DEBUG (g_message ("set_line_width (%f)", path->line_width));
@@ -436,6 +440,7 @@ render_start_element (GMarkupParseContext *context,
ctx->page->priv->source,
G_MARKUP_ERROR_INVALID_CONTENT,
"Path", "StrokeDashArray", values[i], error);
+ gxps_path_free (path);
return;
}
GXPS_DEBUG (g_message ("set_dash"));
@@ -445,6 +450,7 @@ render_start_element (GMarkupParseContext *context,
ctx->page->priv->source,
G_MARKUP_ERROR_INVALID_CONTENT,
"Path", "StrokeDashOffset", values[i], error);
+ gxps_path_free (path);
return;
}
GXPS_DEBUG (g_message ("set_dash_offset (%f)", path->dash_offset));
@@ -460,6 +466,7 @@ render_start_element (GMarkupParseContext *context,
ctx->page->priv->source,
G_MARKUP_ERROR_INVALID_CONTENT,
"Path", "StrokeMiterLimit", values[i], error);
+ gxps_path_free (path);
return;
}
GXPS_DEBUG (g_message ("set_miter_limit (%f)", path->miter_limit));
@@ -469,6 +476,7 @@ render_start_element (GMarkupParseContext *context,
ctx->page->priv->source,
G_MARKUP_ERROR_INVALID_CONTENT,
"Path", "Opacity", values[i], error);
+ gxps_path_free (path);
return;
}
GXPS_DEBUG (g_message ("set_opacity (%f)", path->opacity));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]