]> granicus.if.org Git - graphviz/commitdiff
fix bug with cleanup of htmltable structures
authorellson <devnull@localhost>
Mon, 26 Jun 2006 21:14:04 +0000 (21:14 +0000)
committerellson <devnull@localhost>
Mon, 26 Jun 2006 21:14:04 +0000 (21:14 +0000)
lib/common/htmltable.c

index 7f2fc7f4e8e54bede75a8e9ee71e5a4c4f84c921..5b8cba9fce741808a33e21447223610b9a6d68ed 100644 (file)
@@ -498,8 +498,8 @@ void free_html_text(htmltxt_t* t)
     if (!t) return;
 
     tl = t->paras;
+    ti = tl->items;
     for (i = 0; i < t->nparas; i++) {
-       ti = tl->items;
        for (j = 0; j < tl->nitems; j++) {
            if (ti->str) free (ti->str);
            if (ti->xshow) free (ti->xshow);
@@ -508,9 +508,12 @@ void free_html_text(htmltxt_t* t)
            ti++;
        }
        tl++;
+       ti = tl->items;
     }
-    free(tl->items);
-    free(t->paras);
+    if (ti != tl->items)
+       free(tl->items);
+    if (tl != t->paras)
+       free(t->paras);
     free(t);
 }