projects
/
monky
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9fc26df
)
Fix crash in mail stuff due to bad free().
author
Brenden Matthews
<brenden@diddyinc.com>
Thu, 26 Aug 2010 17:32:27 +0000
(10:32 -0700)
committer
Brenden Matthews
<brenden@diddyinc.com>
Thu, 26 Aug 2010 17:32:27 +0000
(10:32 -0700)
src/mail.c
patch
|
blob
|
history
diff --git
a/src/mail.c
b/src/mail.c
index
2d91c62
..
29d6b6e
100644
(file)
--- a/
src/mail.c
+++ b/
src/mail.c
@@
-664,7
+664,7
@@
static void *imap_thread(void *arg)
int threadfd = timed_thread_readfd(mail->p_timed_thread);
char resolved_host = 0;
struct addrinfo hints;
int threadfd = timed_thread_readfd(mail->p_timed_thread);
char resolved_host = 0;
struct addrinfo hints;
- struct addrinfo *ai, *rp;
+ struct addrinfo *ai = 0, *rp;
char portbuf[8];
while (fail < mail->retries) {
char portbuf[8];
while (fail < mail->retries) {
@@
-704,6
+704,7
@@
static void *imap_thread(void *arg)
close(sockfd);
}
freeaddrinfo(ai);
close(sockfd);
}
freeaddrinfo(ai);
+ ai = 0;
if (rp == NULL) {
perror("connect");
fail++;
if (rp == NULL) {
perror("connect");
fail++;
@@
-1010,7
+1011,7
@@
static void *pop3_thread(void *arg)
struct mail_s *mail = (struct mail_s *)arg;
char resolved_host = 0;
struct addrinfo hints;
struct mail_s *mail = (struct mail_s *)arg;
char resolved_host = 0;
struct addrinfo hints;
- struct addrinfo *ai, *rp;
+ struct addrinfo *ai = 0, *rp;
char portbuf[8];
while (fail < mail->retries) {
char portbuf[8];
while (fail < mail->retries) {
@@
-1031,8
+1032,8
@@
static void *pop3_thread(void *arg)
fail++;
break;
}
fail++;
break;
}
- resolved_host = 1;
-}
+ resolved_host = 1;
+ }
if (fail > 0) {
NORM_ERR("Trying POP3 connection again for %s@%s (try %u/%u)",
mail->user, mail->host, fail + 1, mail->retries);
if (fail > 0) {
NORM_ERR("Trying POP3 connection again for %s@%s (try %u/%u)",
mail->user, mail->host, fail + 1, mail->retries);
@@
-1049,6
+1050,7
@@
static void *pop3_thread(void *arg)
close(sockfd);
}
freeaddrinfo(ai);
close(sockfd);
}
freeaddrinfo(ai);
+ ai = 0;
if (rp == NULL) {
perror("connect");
fail++;
if (rp == NULL) {
perror("connect");
fail++;