diff -Nur librsvg2-2.12.4.orig/rsvg-art-paint-server.c librsvg2-2.12.4/rsvg-art-paint-server.c
--- librsvg2-2.12.4.orig/rsvg-art-paint-server.c	2005-07-19 16:47:26.000000000 +0200
+++ librsvg2-2.12.4/rsvg-art-paint-server.c	2005-10-06 17:11:26.000000000 +0200
@@ -45,19 +45,20 @@
 								guint32 current_color)
 {
 	ArtGradientStop *stops;
-	unsigned int n_stop = rstops->len;
+	unsigned int len = rstops->len;
 	unsigned int i, j;
 	
 	j = 0;
-	for (i = 0; i < n_stop; i++)
+	for (i = 0; i < len; i++)
 		if (((RsvgNode *)g_ptr_array_index(rstops, i))->type == RSVG_NODE_STOP)
 			j++;
+
 	*nstops = j;
 	stops = g_new (ArtGradientStop, j);
 
 	j = 0;
 
-	for (i = 0; i < n_stop; i++)
+	for (i = 0; i < len; i++)
 		{
 			RsvgGradientStop * stop;
 			RsvgNode * temp;
@@ -135,15 +136,17 @@
 		current_color = rlg->current_color;
 	else
 		current_color = ctx->color;
-	if (rlg->super.children->len == 0)
-		{
-			return;
-		}
 
 	agl = g_new (ArtGradientLinear, 1);
 	agl->stops = rsvg_paint_art_stops_from_rsvg (rlg->super.children, 
 												 &agl->n_stops, current_color);
-   
+
+	if (agl->n_stops == 0)
+		{
+			g_free (agl->stops);
+			g_free (agl);
+			return;
+		}
 
 	if (rlg->obj_bbox) {
 		affine[0] = ctx->x1 - ctx->x0;
@@ -268,14 +271,18 @@
 		current_color = rrg->current_color;
 	else
 		current_color = ctx->color;
-	if (rrg->super.children->len == 0)
-		{
-			return;
-		}
+	
 	agr = g_new (ArtGradientRadial, 1);
 	agr->stops = rsvg_paint_art_stops_from_rsvg (rrg->super.children, 
 												 &agr->n_stops, current_color);
 	
+	if (agr->n_stops == 0)
+		{
+			g_free (agr->stops);
+			g_free (agr);
+			return;
+		}
+
 	_rsvg_affine_scale (aff1, rrg->r, rrg->r);
 	_rsvg_affine_translate (aff2, rrg->cx, rrg->cy);
 	_rsvg_affine_multiply (aff1, aff1, aff2);
diff -Nur librsvg2-2.12.4.orig/rsvg-paint-server.c librsvg2-2.12.4/rsvg-paint-server.c
--- librsvg2-2.12.4.orig/rsvg-paint-server.c	2005-07-19 16:47:26.000000000 +0200
+++ librsvg2-2.12.4/rsvg-paint-server.c	2005-10-06 17:08:42.000000000 +0200
@@ -501,6 +501,17 @@
 	return &pattern->super;
 }
 
+static int hasstop(GPtrArray *lookin)
+{
+	unsigned int i;
+	for (i = 0; i < lookin->len; i++)
+		{
+			if (((RsvgNode *)g_ptr_array_index(lookin, i))->type == RSVG_NODE_STOP)
+				return 1;
+		}
+	return 0;
+}
+
 void
 rsvg_linear_gradient_fix_fallback(RsvgLinearGradient * grad)
 {
@@ -540,7 +551,7 @@
 					grad->hasbbox = TRUE;
 					grad->obj_bbox = fallback->obj_bbox;
 				}
-				if (!grad->super.children->len && fallback->super.children->len){
+				if (!hasstop(grad->super.children) && hasstop(fallback->super.children)){
 					grad->super.children = fallback->super.children;
 				}
 				ufallback = fallback->fallback; 
@@ -560,7 +571,7 @@
 					grad->hasbbox = TRUE;
 					grad->obj_bbox = fallback->obj_bbox;
 				}
-				if (!grad->super.children->len && fallback->super.children->len){
+				if (!hasstop(grad->super.children) && hasstop(fallback->super.children)){
 					grad->super.children = fallback->super.children;
 				}
 				ufallback = fallback->fallback; 
@@ -611,7 +622,7 @@
 					grad->hasbbox = TRUE;
 					grad->obj_bbox = fallback->obj_bbox;
 				}
-				if (!grad->super.children->len && fallback->super.children->len){
+				if (!hasstop(grad->super.children) && hasstop(fallback->super.children)){
 					grad->super.children = fallback->super.children;
 				}
 				ufallback = fallback->fallback; 
@@ -631,7 +642,7 @@
 					grad->hasbbox = TRUE;
 					grad->obj_bbox = fallback->obj_bbox;
 				}
-				if (!grad->super.children->len && fallback->super.children->len){
+				if (!hasstop(grad->super.children) && hasstop(fallback->super.children)){
 					grad->super.children = fallback->super.children;
 				}
 				ufallback = fallback->fallback; 
