[Dot] Memory leak
Ported Issue from Mantis Original ID: 596 Reported By: Joe MacGillivray
SEVERITY: MINOR Submitted: 2002-03-03 17:53:03
OS: X86-LINUX-MANDRAKE 7.2
VERSION: 1.7.15
DESCRIPTION
The modified dot.c main() below has a memory leak (run with -Tplain option)
STEPS TO REPRODUCE
static graph_t *G;
int main(int argc, char** argv) {
char *graph = "digraph G {\nA;\nB;\nA -> B;\n}";
dotneato_initialize(argc,argv);
while ( 1 )
{
G = agmemread(graph);
dot_layout(G);
dotneato_write(G);
dot_cleanup(G);
agclose(G);
}
dotneato_terminate();
}
ADDITIONAL INFORMATION
The modified dot.c main() was written to check for memory leaks. I'd like to extract the layout behaviour from dot an run as a deamon that accepts a graph description and returns layout info.
[ellson] I can reproduce a 2-byte-per-iteration leak with 1.8.1 on Linux.
The leak is dependent on the form of the graph string in some unclear way. "digraph G {A->B}" does not leak, but "digraph G {A;B;A->B}" does.
Running under dmalloc shows the 2-byte leak, but it can't identify the function (meaning the function wasn't in code built with dmalloc.h) and the return address is invalid. 1015214958: 563: not freed: '0x80e5748|s3' (1 bytes) from 'ra=0x401b21f0' 1015214958: 563: not freed: '0x80e5a08|s1' (1 bytes) from 'ra=0x401b21f0'