Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!elroy.jpl.nasa.gov!mahendo!wlbr!sms@wlv.imsd.contel.com From: sms@wlv.imsd.contel.com (Steven M. Schultz) Newsgroups: comp.bugs.2bsd Subject: Memory Leak In sendmail alias handling Message-ID: <33796@wlbr.IMSD.CONTEL.COM> Date: 22 Jul 89 04:06:15 GMT Sender: news@wlbr.IMSD.CONTEL.COM Reply-To: sms@wlv.imsd.contel.com (Steven M. Schultz) Organization: Contel Federal Systems Lines: 55 Bcc: sms There is a major memory leak in sendmail's building of the dbm alias database from /usr/lib/aliases. Large numbers of aliases will cause sendmail to run out of memory, leaving partially constructed dbm files. The earlier fix i posted for this problem was incomplete (and partially incorrect), this patch corrects both problems. Apply the following patch to src/sendmail/alias.c and recompile sendmail. *** alias.c.old Wed Mar 8 14:54:25 1989 --- alias.c Fri Jul 21 13:39:46 1989 *************** *** 453,459 **** break; if (parseaddr(p, &bl, -1, ',') == NULL) usrerr("%s... bad address", p); ! free(bl); p = DelimChar; } } --- 453,460 ---- break; if (parseaddr(p, &bl, -1, ',') == NULL) usrerr("%s... bad address", p); ! if (bl.q_host && bl.q_host[0]) ! free(bl.q_host); p = DelimChar; } } *************** *** 499,505 **** content.dsize = rhssize; content.dptr = rhs; store(key, content); ! free(al); } else # endif DBM --- 500,511 ---- content.dsize = rhssize; content.dptr = rhs; store(key, content); ! if (al.q_paddr) ! free(al.q_paddr); ! if (al.q_host) ! free(al.q_host); ! if (al.q_user) ! free(al.q_user); } else # endif DBM ======================================================================