[cairo-commit] libsvg/src svg_style.c,1.21,1.22

Keith Packard commit at pdx.freedesktop.org
Thu May 12 11:37:51 PDT 2005


Committed by: keithp

Update of /cvs/cairo/libsvg/src
In directory gabe:/tmp/cvs-serv18865/src

Modified Files:
	svg_style.c 
Log Message:
2005-05-12  Keith Packard  <keithp at keithp.com>

	reviewed by: cworth

	* src/svg_style.c: (_svg_style_init_empty), (_svg_style_deinit):
	Valgrind discovered a few memory leaks and use of uninitialized
	values.  There are leaks remaining in the xml parsing code which
	are demonstrated by several of the w3c svg conformance suite.


Index: svg_style.c
===================================================================
RCS file: /cvs/cairo/libsvg/src/svg_style.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- svg_style.c	21 Apr 2005 19:29:19 -0000	1.21
+++ svg_style.c	12 May 2005 18:37:49 -0000	1.22
@@ -170,6 +170,13 @@
     style->stroke_dash_array = NULL;
     style->stroke_dash_offset.value = 0;
 
+    /* initialize unused elements so copies are predictable */
+    style->stroke_line_cap = SVG_STROKE_LINE_CAP_BUTT;
+    style->stroke_line_join = SVG_STROKE_LINE_JOIN_MITER;
+    style->stroke_miter_limit = 4.0;
+    style->stroke_opacity = 1.0;
+    style->fill_opacity = 1.0;
+    
     /* opacity is not inherited */
     style->flags |= SVG_STYLE_FLAG_OPACITY;
     style->opacity = 1.0;
@@ -259,6 +266,11 @@
 	free (style->font_family);
     style->font_family = NULL;
 
+    if (style->stroke_dash_array)
+	free (style->stroke_dash_array);
+    style->stroke_dash_array = NULL;
+    style->num_dashes = 0;
+    
     style->flags = SVG_STYLE_FLAG_NONE;
 
     return SVG_STATUS_SUCCESS;




More information about the cairo-commit mailing list