Number: 2069
Title: memory leaks in dot
Submitter: stefan Kost
Date: Thu Nov 4 22:00:30 2010
Subsys: Dot
Version: 2.27
System: *-*-
Severity: minor
Problem:
The attached C program has a memory leak.


==23010== Invalid read of size 1
==23010==    at 0x4140D43: strcasecmp (strcasecmp.c:65)
==23010==    by 0x406A6CF: textsize (fontmetrics.c:182)
==23010==    by 0x407BA5B: storeline (labels.c:33)
==23010==    by 0x407BB27: make_simple_label (labels.c:101)
==23010==    by 0x407BCE2: make_label (labels.c:182)
==23010==    by 0x4071891: do_graph_label (input.c:901)
==23010==    by 0x40723AC: graph_init (input.c:772)
==23010==    by 0x405B40B: gvLayoutJobs (gvlayout.c:88)
==23010==    by 0x4061E59: gvLayout (gvc.c:94)
==23010==    by 0x8049079: main (in
/home/ensonic/projects/tests/graphviz/gvc)
==23010==  Address 0x42b504c is 12 bytes inside a block of size 20 free'd
==23010==    at 0x4024B3A: free (vg_replace_malloc.c:366)
==23010==    by 0x40C154B: agstrfree (refstr.c:136)
==23010==    by 0x40BABBF: agFREEdict (attribs.c:234)
==23010==    by 0x40BCDFE: agclose (graph.c:159)
==23010==    by 0x804913E: main (in
/home/ensonic/projects/tests/graphviz/gvc)
==23010==
==23010== Invalid read of size 1
==23010==    at 0x402663B: strcmp (mc_replace_strmem.c:426)
==23010==    by 0x402CC88: pango_textlayout (gvtextlayout_pango.c:99)
==23010==    by 0x40609D7: gvtextlayout (gvtextlayout.c:49)
==23010==    by 0x406A742: textsize (fontmetrics.c:206)
==23010==    by 0x407BA5B: storeline (labels.c:33)
==23010==    by 0x407BB27: make_simple_label (labels.c:101)
==23010==    by 0x407BCE2: make_label (labels.c:182)
==23010==    by 0x4071891: do_graph_label (input.c:901)
==23010==    by 0x40723AC: graph_init (input.c:772)
==23010==    by 0x405B40B: gvLayoutJobs (gvlayout.c:88)
==23010==    by 0x4061E59: gvLayout (gvc.c:94)
==23010==    by 0x8049079: main (in
/home/ensonic/projects/tests/graphviz/gvc)
==23010==  Address 0x42b504c is 12 bytes inside a block of size 20 free'd
==23010==    at 0x4024B3A: free (vg_replace_malloc.c:366)
==23010==    by 0x40C154B: agstrfree (refstr.c:136)
==23010==    by 0x40BABBF: agFREEdict (attribs.c:234)
==23010==    by 0x40BCDFE: agclose (graph.c:159)
==23010==    by 0x804913E: main (in
/home/ensonic/projects/tests/graphviz/gvc)
==23010==
==23010== Invalid read of size 1
==23010==    at 0x4026657: strcmp (mc_replace_strmem.c:426)
==23010==    by 0x402CC88: pango_textlayout (gvtextlayout_pango.c:99)
==23010==    by 0x40609D7: gvtextlayout (gvtextlayout.c:49)
==23010==    by 0x406A742: textsize (fontmetrics.c:206)
==23010==    by 0x407BA5B: storeline (labels.c:33)
==23010==    by 0x407BB27: make_simple_label (labels.c:101)
==23010==    by 0x407BCE2: make_label (labels.c:182)
==23010==    by 0x4071891: do_graph_label (input.c:901)
==23010==    by 0x40723AC: graph_init (input.c:772)
==23010==    by 0x405B40B: gvLayoutJobs (gvlayout.c:88)
==23010==    by 0x4061E59: gvLayout (gvc.c:94)
==23010==    by 0x8049079: main (in
/home/ensonic/projects/tests/graphviz/gvc)
==23010==  Address 0x42b504d is 13 bytes inside a block of size 20 free'd
==23010==    at 0x4024B3A: free (vg_replace_malloc.c:366)
==23010==    by 0x40C154B: agstrfree (refstr.c:136)
==23010==    by 0x40BABBF: agFREEdict (attribs.c:234)
==23010==    by 0x40BCDFE: agclose (graph.c:159)
==23010==    by 0x804913E: main (in
/home/ensonic/projects/tests/graphviz/gvc)

Input file: b2069.c
Comments:
[erg] Related to bug 2048. As with that bug, it is only necessary to run dot on the generated graph.

Also note that creating a subgraph in the root graph and then inserting it into another subgraph causes the output graph to contain two copies of a subgraph. I'm not sure this is a good idea. The parser actually warns about this, because it can cause strange behavior, especially if the subgraphs are clusters.
Owner: *
Status: *