only release cairo stuff if we ever initialized it.
authoroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Wed, 1 Aug 2007 15:29:09 +0000 (15:29 +0000)
committeroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Wed, 1 Aug 2007 15:29:09 +0000 (15:29 +0000)
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1178 a5681a0c-68f1-0310-ab6d-d61299d08faa

src/rrd_graph.c

index e295397..d6568f3 100644 (file)
@@ -308,7 +308,7 @@ int im_free(
     image_desc_t *im)
 {
     unsigned long i, ii;
-    cairo_status_t status;
+    cairo_status_t status = 0;
 
     if (im == NULL)
         return 0;
@@ -329,10 +329,10 @@ int im_free(
     if (im->font_options)
         cairo_font_options_destroy(im->font_options);
 
-    status = cairo_status(im->cr);
-
-    if (im->cr)
+    if (im->cr) {
+        status = cairo_status(im->cr);
         cairo_destroy(im->cr);
+    }
     if (im->surface)
         cairo_surface_destroy(im->surface);
     if (status)