Good point :) I moved the b64 from the inner block and check/free it on exit ... it should fix the possible leak.

Thanks,
Martin


On Aug 12, 2007, at 2:48 PM, Jan-Henrik Haukeland wrote:


On 12. aug. 2007, at 13.09, Martin Pala wrote:

http://cvs.savannah.gnu.org/viewcvs/monit/sendmail.c? cvsroot=monit&r1=1.48&r2=1.49


There is a potential memory leak in sendmail.c here,

    b64 = encode_base64(len, buffer);
    do_send(&S, "AUTH PLAIN %s\r\n", b64);
    free(b64);

if do_send fails it long jumps and free(b64) will never be called. To avoid this, everything in the block, if(S.username) { auth } could be put in its own do_auth function which calls socket_write directly and frees b64 if write failed. I can fix this, but since you are in the process of preparing a release I thought I should ask first if it is okay, so I don't mess up any code checkin.


_______________________________________________
monit-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/monit-dev



_______________________________________________
monit-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/monit-dev

Reply via email to