diff options
-rw-r--r-- | NEWS | 5 | ||||
-rw-r--r-- | checkalias.c | 13 | ||||
-rw-r--r-- | driver.c | 3 | ||||
-rw-r--r-- | fetchmail.c | 13 | ||||
-rw-r--r-- | options.c | 16 | ||||
-rw-r--r-- | pop3.c | 10 | ||||
-rw-r--r-- | unmime.c | 17 |
7 files changed, 48 insertions, 29 deletions
@@ -1,5 +1,10 @@ Release Notes: +fetchmail-4.6.1 (): +* Fixed a minor memory leak in the IP-address-comparison code. +* Mark Staveley's patch to suppress progress dots from non-detached daemon + fetchmails. + fetchmail-4.6.0 (Fri Sep 18 13:17:17 EDT 1998): * Added Bill Adams's mailqueue.pl to the contrib directory. * Try to enable KPOP initialization to work even if `no dns' is on. diff --git a/checkalias.c b/checkalias.c index eb045e37..275e9410 100644 --- a/checkalias.c +++ b/checkalias.c @@ -13,6 +13,13 @@ #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> +#if defined(HAVE_ALLOCA_H) +#include <alloca.h> +#else +#ifdef _AIX + #pragma alloca +#endif +#endif #include "mx.h" #include "fetchmail.h" @@ -48,7 +55,7 @@ static int is_ip_alias(const char *name1,const char *name2) { struct in_addr in; (void) memcpy(&in.s_addr, *p, sizeof (in.s_addr)); - host_a_addr = (address_e *)xmalloc(sizeof( address_e)); + host_a_addr = (address_e *)alloca(sizeof( address_e)); memset (host_a_addr,0, sizeof (address_e)); host_a_addr->next = dummy_addr; (void) memcpy(&host_a_addr->address, *p, sizeof (in.s_addr)); @@ -62,7 +69,7 @@ static int is_ip_alias(const char *name1,const char *name2) { struct in_addr in; (void) memcpy(&in.s_addr, *p, sizeof (in.s_addr)); - host_b_addr = (address_e *)xmalloc(sizeof( address_e)); + host_b_addr = (address_e *)alloca(sizeof( address_e)); memset (host_b_addr,0, sizeof (address_e)); host_b_addr->next = dummy_addr; (void) memcpy(&host_b_addr->address, *p, sizeof (in.s_addr)); @@ -121,7 +128,7 @@ int is_host_alias(const char *name, struct query *ctl) #else /* * The only code that calls the BIND library is here and in the - * start-of-run probe with gethostbyname(3). + * start-of-run probe with gethostbyname(3) under ETRN/Kerberos. * * We know DNS service was up at the beginning of the run. * If it's down, our nameserver has crashed. We don't want to try @@ -1633,7 +1633,7 @@ const char *canonical; /* server name */ Key_schedule schedule; int rem; - ticket = ((KTEXT) (malloc (sizeof (KTEXT_ST)))); + ticket = ((KTEXT) (alloca (sizeof (KTEXT_ST)))); rem = (krb_sendauth (0L, socket, ticket, "pop", canonical, ((char *) (krb_realmofhost (canonical))), @@ -1644,7 +1644,6 @@ const char *canonical; /* server name */ ((struct sockaddr_in *) 0), ((struct sockaddr_in *) 0), "KPOPV0.1")); - free (ticket); if (rem != KSUCCESS) { error(0, -1, "kerberos error %s", (krb_get_err_text (rem))); diff --git a/fetchmail.c b/fetchmail.c index 41cff121..32fe7659 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -210,7 +210,7 @@ int main (int argc, char **argv) /* set up to do lock protocol */ #define FETCHMAIL_PIDFILE "fetchmail.pid" - tmpbuf = xmalloc(strlen(home) + strlen(FETCHMAIL_PIDFILE) + 3); + tmpbuf = alloca(strlen(home) + strlen(FETCHMAIL_PIDFILE) + 3); if (!getuid()) sprintf(tmpbuf, "%s/%s", PID_DIR, FETCHMAIL_PIDFILE); else { @@ -352,7 +352,7 @@ int main (int argc, char **argv) } /* parse the ~/.netrc file (if present) for future password lookups. */ - netrc_file = (char *) xmalloc (strlen (home) + 8); + netrc_file = (char *) alloca (strlen (home) + 8); strcpy (netrc_file, home); strcat (netrc_file, "/.netrc"); netrc_list = parse_netrc(netrc_file); @@ -403,9 +403,8 @@ int main (int argc, char **argv) #endif /* GSSAPI */ && !ctl->password) { - free(tmpbuf); #define PASSWORD_PROMPT "Enter password for %s@%s: " - tmpbuf = xmalloc(strlen(PASSWORD_PROMPT) + + tmpbuf = alloca(strlen(PASSWORD_PROMPT) + strlen(ctl->remotename) + strlen(ctl->server.pollname) + 1); (void) sprintf(tmpbuf, PASSWORD_PROMPT, @@ -415,10 +414,6 @@ int main (int argc, char **argv) } } - /* we don't need tmpbuf anymore */ - free(tmpbuf); - tmpbuf = NULL; /* firewall code */ - /* * Maybe time to go to demon mode... */ @@ -430,7 +425,7 @@ int main (int argc, char **argv) } else #endif - error_init(run.poll_interval == 0 && !run.logfile); + error_init((run.poll_interval == 0 || nodetach) && !run.logfile); if (run.poll_interval) { @@ -7,6 +7,13 @@ #include "config.h" #include <stdio.h> +#if defined(HAVE_ALLOCA_H) +#include <alloca.h> +#else +#ifdef _AIX + #pragma alloca +#endif +#endif #include <pwd.h> #include <string.h> #include <errno.h> @@ -406,18 +413,17 @@ struct query *ctl; /* option record to be initialized */ break; case 'r': case LA_FOLDER: - buf = xmalloc(strlen(optarg)); + buf = alloca(strlen(optarg)); strcpy(buf, optarg); cp = strtok(buf, ","); do { save_str(&ctl->mailboxes, cp, 0); } while ((cp = strtok((char *)NULL, ","))); - free(buf); break; case 'S': case LA_SMTPHOST: - buf = xmalloc(strlen(optarg)); + buf = alloca(strlen(optarg)); strcpy(buf, optarg); cp = strtok(buf, ","); do { @@ -425,7 +431,6 @@ struct query *ctl; /* option record to be initialized */ } while ((cp = strtok((char *)NULL, ","))); ocount++; - free(buf); break; case 'D': case LA_SMTPADDR: @@ -433,7 +438,7 @@ struct query *ctl; /* option record to be initialized */ break; case 'Z': case LA_ANTISPAM: - buf = xmalloc(strlen(optarg)); + buf = alloca(strlen(optarg)); strcpy(buf, optarg); cp = strtok(buf, ","); do { @@ -442,7 +447,6 @@ struct query *ctl; /* option record to be initialized */ idp->val.status.num = atoi(cp); } while ((cp = strtok((char *)NULL, ","))); - free(buf); break; case 'b': case LA_BATCHLIMIT: @@ -7,6 +7,13 @@ #include "config.h" #ifdef POP3_ENABLE #include <stdio.h> +#if defined(HAVE_ALLOCA_H) +#include <alloca.h> +#else +#ifdef _AIX + #pragma alloca +#endif +#endif #include <string.h> #include <ctype.h> #if defined(HAVE_UNISTD_H) @@ -218,12 +225,11 @@ int pop3_getauth(int sock, struct query *ctl, char *greeting) *++end = '\0'; /* copy timestamp and password into digestion buffer */ - msg = (char *)xmalloc((end-start+1) + strlen(ctl->password) + 1); + msg = (char *)alloca((end-start+1) + strlen(ctl->password) + 1); strcpy(msg,start); strcat(msg,ctl->password); strcpy(ctl->digest, MD5Digest(msg)); - free(msg); ok = gen_transact(sock, "APOP %s %s", ctl->remotename, ctl->digest); break; @@ -14,6 +14,13 @@ #include <string.h> #include <stdlib.h> +#if defined(HAVE_ALLOCA_H) +#include <alloca.h> +#else +#ifdef _AIX + #pragma alloca +#endif +#endif #include <ctype.h> #include "fetchmail.h" @@ -363,7 +370,7 @@ int MimeBodyType(unsigned char *hdrs, int WantDecode) XferEncOfs = NxtHdr; p = nxtaddr(NxtHdr); if (p != NULL) { - XferEnc = (char *)xmalloc(strlen(p) + 1); + XferEnc = (char *)alloca(strlen(p) + 1); strcpy(XferEnc, p); HdrsFound++; } @@ -394,7 +401,7 @@ int MimeBodyType(unsigned char *hdrs, int WantDecode) } while ( (p != NULL) && ((*(p+1) == '\t') || (*(p+1) == ' ')) ); if (p == NULL) p = NxtHdr + strlen(NxtHdr); - CntType = (char *)xmalloc(p-NxtHdr+2); + CntType = (char *)alloca(p-NxtHdr+2); strncpy(CntType, NxtHdr, (p-NxtHdr)); *(CntType+(p-NxtHdr)) = '\0'; HdrsFound++; @@ -402,7 +409,7 @@ int MimeBodyType(unsigned char *hdrs, int WantDecode) else if (strncasecmp("MIME-Version:", NxtHdr, 13) == 0) { p = nxtaddr(NxtHdr); if (p != NULL) { - MimeVer = (char *)xmalloc(strlen(p) + 1); + MimeVer = (char *)alloca(strlen(p) + 1); strcpy(MimeVer, p); HdrsFound++; } @@ -456,10 +463,6 @@ int MimeBodyType(unsigned char *hdrs, int WantDecode) } - if (MimeVer) free(MimeVer); - if (XferEnc) free(XferEnc); - if (CntType) free(CntType); - return BodyType; } |