Memory leak fixes

This commit is contained in:
Michiel Broek 2002-06-18 18:52:48 +00:00
parent 5de2f5d1d9
commit 36785de6e5
7 changed files with 36 additions and 21 deletions

View File

@ -333,6 +333,7 @@ int main(int argc, char *argv[])
if (!do_quiet)
printf("File attach %s is successfull", argv[4]);
CreateSema((char *)"scanout");
tidy_faddr(addr);
die(0);
} else {
Fatal((char *)"File attach failed");

View File

@ -51,7 +51,7 @@ void ForwardFile(fidoaddr Node, fa_list *sbl)
char *subject = NULL, *temp, *fwdfile = NULL, *ticfile = NULL, fname[PATH_MAX], *ticname;
FILE *fp, *fi, *net;
char flavor;
faddr *dest, *routeto, *Fa, *Temp;
faddr *dest, *routeto, *Fa, *Temp, *ba;
int i, z, n;
time_t now, ftime;
fa_list *tmp;
@ -226,8 +226,10 @@ void ForwardFile(fidoaddr Node, fa_list *sbl)
now = time(NULL);
subject = ctime(&now);
Striplf(subject);
fprintf(fp, "Path %s %lu %s %s\r\n", ascfnode(bestaka_s(dest), 0x1f),
ba = bestaka_s(dest);
fprintf(fp, "Path %s %lu %s %s\r\n", ascfnode(ba, 0x1f),
mktime(localtime(&now)), subject, tzname[0]);
tidy_faddr(ba);
if (nodes.AdvTic) {
/*

View File

@ -80,7 +80,7 @@ void fill_rlist(fa_list **fap, char *str)
*q++='\0';
else
q=p+strlen(p);
if ((ta=parsefaddr(p))) {
if ((ta = parsefaddr(p))) {
if (ta->net == 0)
ta->net=oldnet;
else
@ -222,7 +222,7 @@ void substitute(char *buf)
case ')': if (!inquotes && inbrackets) inbrackets--; break;
default: break;
}
if ((fa=parsefaddr(l))) {
if ((fa = parsefaddr(l))) {
Syslog('m', "it is an ftn address: %s",ascfnode(fa,0x7f));
if (is_local(fa)) {
Syslog('m', "it is local");
@ -1069,7 +1069,9 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl
sprintf(temp,"Reply-To: %s",p);
Send(newsmode, temp);
} else if ((p=hdr((char *)"REPLYTO",kmsg))) {
sprintf(temp,"Reply-To: %s\n",ascinode(parsefaddr(p),0xff));
ta = parsefaddr(p);
sprintf(temp,"Reply-To: %s\n",ascinode(ta, 0xff));
tidy_faddr(ta);
Send(newsmode, temp);
}

View File

@ -415,9 +415,11 @@ int postnetmail(FILE *fp, faddr *f, faddr *t, char *orig, char *subject, time_t
now = time(NULL);
tm = gmtime(&now);
ta = bestaka_s(t);
fprintf(net, "\001Via %s @%d%02d%02d.%02d%02d%02d.00.UTC mbfido %s\r",
ascfnode(bestaka_s(t), 0x1f), tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday,
ascfnode(ta, 0x1f), tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday,
tm->tm_hour, tm->tm_min, tm->tm_sec, VERSION);
tidy_faddr(ta);
putc(0, net);
fclose(net);

View File

@ -140,7 +140,7 @@ int rfc2ftn(FILE *fp, faddr *recipient)
ftnmsg *fmsg = NULL;
FILE *ofp;
fa_list *sbl = NULL, *ptl = NULL, *tmpl;
faddr *ta;
faddr *ta, *fta;
unsigned long svmsgid, svreply;
int sot_kludge = FALSE, eot_kludge = FALSE, qp_or_base64 = FALSE, tinyorigin = FALSE;
int needsplit, hdrsize, datasize, splitpart, forbidsplit, rfcheaders;
@ -472,8 +472,11 @@ int rfc2ftn(FILE *fp, faddr *recipient)
hdrsize += 15;
if (newsmode)
fprintf(ofp,"\1REPLYTO: %s UUCP\n", aka2str(msgs.Aka));
else
fprintf(ofp,"\1REPLYTO: %s UUCP\n", ascfnode(bestaka_s(fmsg->to), 0x1f));
else {
fta = bestaka_s(fmsg->to);
fprintf(ofp,"\1REPLYTO: %s UUCP\n", ascfnode(fta, 0x1f));
tidy_faddr(fta);
}
} else if ((p = hdr((char *)"Reply-To",msg))) {
if ((ta = parsefaddr(p))) {
if ((q = hdr((char *)"From",msg))) {

View File

@ -817,7 +817,9 @@ void ExportNet(unsigned long MsgNum, int UUCPgate)
/*
* Check if this a netmail to our own local UUCP gate.
*/
if ((!strcmp(Msg.To, "UUCP")) && (is_local(parsefnode(Msg.ToAddress)))) {
ta = parsefnode(Msg.ToAddress);
if ((!strcmp(Msg.To, "UUCP")) && (is_local(ta))) {
tidy_faddr(ta);
most_debug = TRUE;
Syslog('m', "We are the UUCP gate");
Syslog('m', "From %s FromAddress %s", Msg.From, Msg.FromAddress);
@ -892,6 +894,7 @@ void ExportNet(unsigned long MsgNum, int UUCPgate)
fclose(fp);
return;
}
tidy_faddr(ta);
if (UUCPgate) {
memcpy(&Dest, &CFG.UUCPgate, sizeof(fidoaddr));

View File

@ -132,19 +132,21 @@ FILE *SendMgrMail(faddr *t, int Keep, int FileAttach, char *bymgr, char *subj, c
void CloseMail(FILE *qp, faddr *t)
{
time_t Now;
struct tm *tm;
time_t Now;
struct tm *tm;
faddr *ta;
putc('\r', qp);
Now = time(NULL);
tm = gmtime(&Now);
fprintf(qp, "\001Via %s @%d%02d%02d.%02d%02d%02d.02.UTC %s\r",
ascfnode(bestaka_s(t), 0x1f), tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday,
putc('\r', qp);
Now = time(NULL);
tm = gmtime(&Now);
ta = bestaka_s(t);
fprintf(qp, "\001Via %s @%d%02d%02d.%02d%02d%02d.02.UTC %s\r",
ascfnode(ta, 0x1f), tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday,
tm->tm_hour, tm->tm_min, tm->tm_sec, VERSION);
putc(0, qp);
fclose(qp);
net_out++;
tidy_faddr(ta);
putc(0, qp);
fclose(qp);
net_out++;
}