|
|
9770e7 |
diff --git a/aux.c b/aux.c
|
|
|
9770e7 |
index e51a19a..2733787 100644
|
|
|
9770e7 |
--- a/aux.c
|
|
|
9770e7 |
+++ b/aux.c
|
|
|
9770e7 |
@@ -904,7 +904,7 @@ getrandstring(size_t length)
|
|
|
9770e7 |
data[i] = (int)(255 * (rand() / (RAND_MAX + 1.0))) ^
|
|
|
9770e7 |
nodedigest[i % sizeof nodedigest];
|
|
|
9770e7 |
}
|
|
|
9770e7 |
- if (fd > 0)
|
|
|
9770e7 |
+ if (fd >= 0)
|
|
|
9770e7 |
close(fd);
|
|
|
9770e7 |
cp = memtob64(data, length);
|
|
|
9770e7 |
rp = salloc(length+1);
|
|
|
9770e7 |
diff --git a/cache.c b/cache.c
|
|
|
9770e7 |
index 9cf7587..a71b019 100644
|
|
|
9770e7 |
--- a/cache.c
|
|
|
9770e7 |
+++ b/cache.c
|
|
|
9770e7 |
@@ -588,6 +588,7 @@ cache_setptr(int transparent)
|
|
|
9770e7 |
message[i].m_uid = contents[i];
|
|
|
9770e7 |
getcache1(&mb, &message[i], NEED_UNSPEC, 3);
|
|
|
9770e7 |
}
|
|
|
9770e7 |
+ free(contents);
|
|
|
9770e7 |
ok = OKAY;
|
|
|
9770e7 |
if (ok == OKAY) {
|
|
|
9770e7 |
mb.mb_type = MB_CACHE;
|
|
|
9770e7 |
diff --git a/cmd3.c b/cmd3.c
|
|
|
9770e7 |
index cb19e2b..2a5ea68 100644
|
|
|
9770e7 |
--- a/cmd3.c
|
|
|
9770e7 |
+++ b/cmd3.c
|
|
|
9770e7 |
@@ -835,7 +835,7 @@ cfile(void *v)
|
|
|
9770e7 |
newfileinfo();
|
|
|
9770e7 |
return 0;
|
|
|
9770e7 |
}
|
|
|
9770e7 |
- strncpy(mboxname, expand("&"), sizeof mboxname)[sizeof mboxname-1]='\0';
|
|
|
9770e7 |
+ strncpy(mboxname, expand("&"), sizeof mboxname-1)[sizeof mboxname-1]='\0';
|
|
|
9770e7 |
return file1(*argv);
|
|
|
9770e7 |
}
|
|
|
9770e7 |
|
|
|
9770e7 |
@@ -1344,7 +1344,7 @@ account(void *v)
|
|
|
9770e7 |
a->ac_name = NULL;
|
|
|
9770e7 |
return define1(args[0], 1);
|
|
|
9770e7 |
}
|
|
|
9770e7 |
- strncpy(mboxname, expand("&"), sizeof mboxname)[sizeof mboxname-1]='\0';
|
|
|
9770e7 |
+ strncpy(mboxname, expand("&"), sizeof mboxname-1)[sizeof mboxname-1]='\0';
|
|
|
9770e7 |
oqf = savequitflags();
|
|
|
9770e7 |
if ((a = get_oldaccount(args[0])) == NULL) {
|
|
|
9770e7 |
if (args[1]) {
|
|
|
9770e7 |
diff --git a/collect.c b/collect.c
|
|
|
9770e7 |
index 953ae07..949fd32 100644
|
|
|
9770e7 |
--- a/collect.c
|
|
|
9770e7 |
+++ b/collect.c
|
|
|
9770e7 |
@@ -902,6 +902,11 @@ cont:
|
|
|
9770e7 |
}
|
|
|
9770e7 |
goto out;
|
|
|
9770e7 |
err:
|
|
|
9770e7 |
+ if (linebuf != NULL) {
|
|
|
9770e7 |
+ free(linebuf);
|
|
|
9770e7 |
+ linebuf = NULL;
|
|
|
9770e7 |
+ }
|
|
|
9770e7 |
+
|
|
|
9770e7 |
if (collf != NULL) {
|
|
|
9770e7 |
Fclose(collf);
|
|
|
9770e7 |
collf = NULL;
|
|
|
9770e7 |
@@ -909,6 +914,9 @@ err:
|
|
|
9770e7 |
exit(1);
|
|
|
9770e7 |
}
|
|
|
9770e7 |
out:
|
|
|
9770e7 |
+ if (linebuf != NULL)
|
|
|
9770e7 |
+ free(linebuf);
|
|
|
9770e7 |
+
|
|
|
9770e7 |
if (collf != NULL) {
|
|
|
9770e7 |
if ((cp = value("MAILX_TAIL")) != NULL) {
|
|
|
9770e7 |
if (is_a_tty[0])
|
|
|
9770e7 |
diff --git a/imap.c b/imap.c
|
|
|
9770e7 |
index 66e0a6b..28b5e22 100644
|
|
|
9770e7 |
--- a/imap.c
|
|
|
9770e7 |
+++ b/imap.c
|
|
|
9770e7 |
@@ -1181,8 +1181,10 @@ imap_setfile1(const char *xserver, int newmail, int isedit, int transparent)
|
|
|
9770e7 |
if (!same_imap_account) {
|
|
|
9770e7 |
if (!disconnected(account) &&
|
|
|
9770e7 |
sopen(sp, &so, use_ssl, uhp,
|
|
|
9770e7 |
- use_ssl ? "imaps" : "imap", verbose) != OKAY)
|
|
|
9770e7 |
- return -1;
|
|
|
9770e7 |
+ use_ssl ? "imaps" : "imap", verbose) != OKAY) {
|
|
|
9770e7 |
+ free(account);
|
|
|
9770e7 |
+ return -1;
|
|
|
9770e7 |
+ }
|
|
|
9770e7 |
} else
|
|
|
9770e7 |
so = mb.mb_sock;
|
|
|
9770e7 |
if (!transparent)
|
|
|
9770e7 |
diff --git a/macro.c b/macro.c
|
|
|
9770e7 |
index 741343b..6aba6aa 100644
|
|
|
9770e7 |
--- a/macro.c
|
|
|
9770e7 |
+++ b/macro.c
|
|
|
9770e7 |
@@ -128,6 +128,7 @@ define1(const char *name, int account)
|
|
|
9770e7 |
mp->ma_name);
|
|
|
9770e7 |
if (sourcing)
|
|
|
9770e7 |
unstack();
|
|
|
9770e7 |
+ freelines(lst);
|
|
|
9770e7 |
free(mp->ma_name);
|
|
|
9770e7 |
free(mp);
|
|
|
9770e7 |
return 1;
|
|
|
9770e7 |
diff --git a/main.c b/main.c
|
|
|
9770e7 |
index 573ec9c..f7612a5 100644
|
|
|
9770e7 |
--- a/main.c
|
|
|
9770e7 |
+++ b/main.c
|
|
|
9770e7 |
@@ -462,7 +462,7 @@ usage:
|
|
|
9770e7 |
*/
|
|
|
9770e7 |
if ((cp = value("folder")) != NULL &&
|
|
|
9770e7 |
which_protocol(cp) == PROTO_IMAP)
|
|
|
9770e7 |
- strncpy(mailname, cp, PATHSIZE)[PATHSIZE-1] = '\0';
|
|
|
9770e7 |
+ strncpy(mailname, cp, PATHSIZE-1)[PATHSIZE-1] = '\0';
|
|
|
9770e7 |
}
|
|
|
9770e7 |
i = setfile(ef, 0);
|
|
|
9770e7 |
if (i < 0)
|
|
|
9770e7 |
@@ -500,7 +500,7 @@ usage:
|
|
|
9770e7 |
safe_signal(SIGINT, SIG_IGN);
|
|
|
9770e7 |
safe_signal(SIGQUIT, SIG_IGN);
|
|
|
9770e7 |
}
|
|
|
9770e7 |
- strncpy(mboxname, expand("&"), sizeof mboxname)[sizeof mboxname-1]='\0';
|
|
|
9770e7 |
+ strncpy(mboxname, expand("&"), sizeof mboxname-1)[sizeof mboxname-1]='\0';
|
|
|
9770e7 |
quit();
|
|
|
9770e7 |
return exit_status;
|
|
|
9770e7 |
}
|
|
|
9770e7 |
diff --git a/popen.c b/popen.c
|
|
|
9770e7 |
index 348fd1e..9520b41 100644
|
|
|
9770e7 |
--- a/popen.c
|
|
|
9770e7 |
+++ b/popen.c
|
|
|
9770e7 |
@@ -246,9 +246,11 @@ Zopen(const char *file, const char *mode, int *compression)
|
|
|
9770e7 |
open: if ((output = Ftemp(&tempfn, "Rz", "w+", 0600, 0)) == NULL) {
|
|
|
9770e7 |
perror(catgets(catd, CATSET, 167, "tmpfile"));
|
|
|
9770e7 |
close(input);
|
|
|
9770e7 |
+ Ftfree(&tempfn);
|
|
|
9770e7 |
return NULL;
|
|
|
9770e7 |
}
|
|
|
9770e7 |
unlink(tempfn);
|
|
|
9770e7 |
+ Ftfree(&tempfn);
|
|
|
9770e7 |
if (input >= 0 || (*compression&FP_MASK) == FP_IMAP ||
|
|
|
9770e7 |
(*compression&FP_MASK) == FP_MAILDIR) {
|
|
|
9770e7 |
if (decompress(*compression, input, fileno(output)) < 0) {
|
|
|
9770e7 |
diff --git a/quit.c b/quit.c
|
|
|
9770e7 |
index f70aec2..1827516 100644
|
|
|
9770e7 |
--- a/quit.c
|
|
|
9770e7 |
+++ b/quit.c
|
|
|
9770e7 |
@@ -141,7 +141,7 @@ quit(void)
|
|
|
9770e7 |
FILE *fbuf, *rbuf, *readstat = NULL, *abuf;
|
|
|
9770e7 |
struct message *mp;
|
|
|
9770e7 |
int c;
|
|
|
9770e7 |
- char *tempResid;
|
|
|
9770e7 |
+ char *tempResid = NULL;
|
|
|
9770e7 |
struct stat minfo;
|
|
|
9770e7 |
|
|
|
9770e7 |
/*
|
|
|
9770e7 |
@@ -313,6 +313,8 @@ cream:
|
|
|
9770e7 |
|
|
|
9770e7 |
newmail:
|
|
|
9770e7 |
printf(catgets(catd, CATSET, 166, "Thou hast new mail.\n"));
|
|
|
9770e7 |
+ if (tempResid != NULL)
|
|
|
9770e7 |
+ Ftfree(&tempResid);
|
|
|
9770e7 |
if (fbuf != NULL) {
|
|
|
9770e7 |
Fclose(fbuf);
|
|
|
9770e7 |
dot_unlock(mailname);
|
|
|
9770e7 |
diff --git a/send.c b/send.c
|
|
|
9770e7 |
index ea3d5b7..40e6bda 100644
|
|
|
9770e7 |
--- a/send.c
|
|
|
9770e7 |
+++ b/send.c
|
|
|
9770e7 |
@@ -568,6 +568,7 @@ skip: switch (ip->m_mimecontent) {
|
|
|
9770e7 |
Pclose(obuf);
|
|
|
9770e7 |
safe_signal(SIGPIPE, oldpipe);
|
|
|
9770e7 |
}
|
|
|
9770e7 |
+ obuf = origobuf;
|
|
|
9770e7 |
}
|
|
|
9770e7 |
}
|
|
|
9770e7 |
return rt;
|
|
|
9770e7 |
diff --git a/sendout.c b/sendout.c
|
|
|
9770e7 |
index f83952a..e734ee2 100644
|
|
|
9770e7 |
--- a/sendout.c
|
|
|
9770e7 |
+++ b/sendout.c
|
|
|
9770e7 |
@@ -463,6 +463,7 @@ infix(struct header *hp, FILE *fi, int dosign)
|
|
|
9770e7 |
if ((nfi = Fopen(tempMail, "r")) == NULL) {
|
|
|
9770e7 |
perror(tempMail);
|
|
|
9770e7 |
Fclose(nfo);
|
|
|
9770e7 |
+ Ftfree(&tempMail);
|
|
|
9770e7 |
return(NULL);
|
|
|
9770e7 |
}
|
|
|
9770e7 |
rm(tempMail);
|
|
|
9770e7 |
@@ -1511,6 +1512,7 @@ resend_msg(struct message *mp, struct name *to, int add_resent)
|
|
|
9770e7 |
if ((nfi = Fopen(tempMail, "r")) == NULL) {
|
|
|
9770e7 |
senderr++;
|
|
|
9770e7 |
perror(tempMail);
|
|
|
9770e7 |
+ Ftfree(&tempMail);
|
|
|
9770e7 |
return STOP;
|
|
|
9770e7 |
}
|
|
|
9770e7 |
rm(tempMail);
|
|
|
9770e7 |
diff --git a/smtp.c b/smtp.c
|
|
|
9770e7 |
index baab5d1..ce6870e 100644
|
|
|
9770e7 |
--- a/smtp.c
|
|
|
9770e7 |
+++ b/smtp.c
|
|
|
9770e7 |
@@ -334,6 +334,7 @@ talk_smtp(struct name *to, FILE *fi, struct sock *sp,
|
|
|
9770e7 |
password);
|
|
|
9770e7 |
b64 = memtob64(o, strlen(user)+strlen(password)+2);
|
|
|
9770e7 |
snprintf(o, sizeof o, "%s\r\n", b64);
|
|
|
9770e7 |
+ free(b64);
|
|
|
9770e7 |
SMTP_OUT(o);
|
|
|
9770e7 |
SMTP_ANSWER(2);
|
|
|
9770e7 |
break;
|
|
|
9770e7 |
diff --git a/ssl.c b/ssl.c
|
|
|
9770e7 |
index 6a0b322..7fbe4a3 100644
|
|
|
9770e7 |
--- a/ssl.c
|
|
|
9770e7 |
+++ b/ssl.c
|
|
|
9770e7 |
@@ -135,6 +135,8 @@ smime_split(FILE *ip, FILE **hp, FILE **bp, long xcount, int keep)
|
|
|
9770e7 |
if ((*hp = Ftemp(&hn, "Rh", "w+", 0600, 1)) == NULL ||
|
|
|
9770e7 |
(*bp = Ftemp(&bn, "Rb", "w+", 0600, 1)) == NULL) {
|
|
|
9770e7 |
perror("tempfile");
|
|
|
9770e7 |
+ if (hn)
|
|
|
9770e7 |
+ Ftfree(&hn;;
|
|
|
9770e7 |
return STOP;
|
|
|
9770e7 |
}
|
|
|
9770e7 |
rm(hn);
|
|
|
9770e7 |
@@ -178,6 +180,7 @@ smime_split(FILE *ip, FILE **hp, FILE **bp, long xcount, int keep)
|
|
|
9770e7 |
fwrite(buf, sizeof *buf, buflen, *bp);
|
|
|
9770e7 |
fflush(*bp);
|
|
|
9770e7 |
rewind(*bp);
|
|
|
9770e7 |
+ free(savedfields);
|
|
|
9770e7 |
free(buf);
|
|
|
9770e7 |
return OKAY;
|
|
|
9770e7 |
}
|