[Date Prev][Date Next] [Chronological] [Thread] [Top]

Possible memory leak using str2entry and entry_free()



Hi,
 
I have a problem with a memory leak concerning the entry build in my search function. I tough that maybe it was some of my code making the leak, but with further research, I realized that the problem was with 2 function tools ( str2entry() and entry_free() ). I went step by step into the code with break points, but I have trouble finding the source of the leak, everything look's ok in the entry_free() function. Here is a demonstration of how I use the str2entry()  and entry_free() function inside my code.
 
...
...
...
Entry *e;
char MailboxInfoString[512];
...
...
 
while(nbMailbox < TotMailbox) {
...
...
 
    // Convert the string to an entry form
    e = str2entry(MailboxInfoString);
...
...
...
     
    // free entry
    entry_free(e);
...
...
...
 
    nbMailbox++;
...
...
}
 
So I am making many calls to str2entry() and entry_free() in order to go trough my database and build up entries.
 
The string in the MailboxInfoString is in the right format for the conversion, here is an example it's content;
"1\ndn: cn=test, o=Virtual, c=CA\ncn: Test Tester\nmail: test@whatever.com\n"
 
after about 2000 passes in the while loop, I get some very important memory leakage. When I remove ( disable ) the str2entry() and entry_free() function and run the test again, there is no more memory leakage.
 
Is there a problem in my way of proceeding?
 
tks
Louis