Number: 99
Title: Memory leak
Submitter: Joe MacGillivray
Date: Sun Mar 3 12:53:03 2002
Subsys: Dot
Version: 1.7.15
System: x86-Linux-Mandrake 7.2
Severity: minor
Problem:
The modified dot.c main() below has a memory leak (run with -Tplain option)
Input:
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();
}
Comments:
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'

Owner: *
Status: *