diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1998-10-08 05:31:22 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1998-10-08 05:31:22 +0000 |
commit | 632f1335893998041f66a25d3809ad719f8557b7 (patch) | |
tree | 4530ed420648800a93d1ccded966c7ef941eb3a6 /fetchmail.c | |
parent | e5cbf59f31c46a8da51b71b16674474be9fe319b (diff) | |
download | fetchmail-632f1335893998041f66a25d3809ad719f8557b7.tar.gz fetchmail-632f1335893998041f66a25d3809ad719f8557b7.tar.bz2 fetchmail-632f1335893998041f66a25d3809ad719f8557b7.zip |
Use alloca where possible.
svn path=/trunk/; revision=2076
Diffstat (limited to 'fetchmail.c')
-rw-r--r-- | fetchmail.c | 13 |
1 files changed, 4 insertions, 9 deletions
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) { |