Skip to content

xdu gobbles memory #19

Closed
thomas opened this issue Jan 25, 2019 · 1 comment
Closed

xdu gobbles memory #19

thomas opened this issue Jan 25, 2019 · 1 comment

Comments

@thomas
Copy link
Contributor

thomas commented Jan 25, 2019

The strdup (~ line 148) in xdu.c:makenode (see below) is unneeded, since the original data isn't freed during runtime,
what can easily be checked with valgrind.

valgrind --leak-check=full ./xdu test.xdu
or with more noise
valgrind --leak-check=full --show-leak-kinds=all  ./xdu test.xdu

(Just for easier reference)

struct node*
makenode(char* name, long long size)
{
    struct node* np;

    np = (struct node*)calloc(1, sizeof(struct node));
    np->name = name; // not strdup(name);
    np->size = size;
    np->num = nnodes;
    nnodes++;

    return np;
}
@donald
Copy link
Contributor

donald commented Feb 7, 2019

Fixed by #17

@donald donald closed this as completed Feb 7, 2019
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants