This is mandatory. You can't ever not do that. In fact, I consider it best practice to do the following:

I've run out of time to finish this, but, the attached patch starts to bzero(3) all malloc(3) calls. I know this is overkill, but for the time being, it's better to be safe than sorry. I'm alarmed at a few of the calls in dbmail_imap_session_new(), however. Why on earth are we malloc(3)'ing a char? The pointer is at least four bytes (depending on your architecture), but the resulting allocation is only one byte. Why bother at all? Why not just make self->tag a character instead of a pointer?

        self->tag = (char *)my_malloc(sizeof(char));
        self->command = (char *)my_malloc(sizeof(char));
        self->args = (char **)my_malloc(sizeof(char **));

?? This really baffled me. Other notes, sizeof(char) is always going to be 1, no matter what. These calls are being optimized away and it's rather silly to have them in the code. Lastly, memset(,0,) is not as fast as bzero(3). I've moved several calls from memset(,0,) to bzero(3) and would suggest the rest of the tree be swept for similar changes. Anyway, I was about halfway through dbmail-imapsession.c before I ran out of time with this. I'll post the patch in a few hours once I finish sweeping through the tree. -sc

--
Sean Chittenden

Reply via email to