In tracking down another problem when memory runs
out, I found an infinite loop.

In mbox.c, starting at line 1633.

for(multiparts = 0; t_line; multiparts++) {
                int lines = 0;
                message **m;


                m = cli_realloc(messages, ((multiparts + 1) *
sizeof(message *)));
                if(m == NULL)
                    break;
                messages = m;


                aMessage = messages[multiparts] = messageCreate();
                if(aMessage == NULL) {
                    multiparts--;
                    continue;
                }

cli_realloc() doesn't fail, so it never breaks out of the loop
from that. messageCreate(), which calls cli_calloc(), DOES fail,
so it decrements the part number and goes back to the for loop,
which increments the part number, which does the same thing it
just tried, with the same results, ad infinitum. What's supposed
to be accomplished by retrying after messageCreate()? Nothing gets
freed in the loop, so why try the calloc() again?

_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html

Reply via email to