don't free any config strings - who cares for a few bytes?

this fixes some crashes at exit.
This commit is contained in:
Oswald Buddenhagen 2003-05-05 17:58:28 +00:00
parent d2b39d2c89
commit 28e240a36b
3 changed files with 8 additions and 34 deletions

View File

@ -172,7 +172,6 @@ load_config (const char *where, int *o2o)
if (boxes)
goto forbid;
/* this only affects the global setting */
free (global.maildir);
global.maildir = expand_strdup (val);
}
else if (!strcasecmp ("folder", cmd))
@ -204,14 +203,7 @@ load_config (const char *where, int *o2o)
cfg->host = strdup (val);
}
else if (!strcasecmp ("user", cmd))
{
if (boxes)
cfg->user = strdup (val);
else {
free (global.user);
global.user = strdup (val);
}
}
cfg->user = strdup (val);
else if (!strcasecmp ("pass", cmd))
cfg->pass = strdup (val);
else if (!strcasecmp ("port", cmd))
@ -288,12 +280,3 @@ find_box (const char *s)
}
return 0;
}
void
free_config (void)
{
free (global.user);
free (global.maildir);
free (global.host);
free (global.pass);
}

View File

@ -196,7 +196,6 @@ int sync_mailbox (mailbox_t *, imap_t *, int, unsigned int, unsigned int);
void load_config (const char *, int *);
char * expand_strdup (const char *s);
config_t *find_box (const char *);
void free_config (void);
void imap_close (imap_t *);
int imap_copy_message (imap_t * imap, unsigned int uid, const char *mailbox);

View File

@ -35,10 +35,6 @@
#include <dirent.h>
#include "isync.h"
#if HAVE_GETOPT_LONG
#define _GNU_SOURCE
#include <getopt.h>
int Quiet;
void
@ -61,6 +57,9 @@ infoc (char c)
putchar (c);
}
#if HAVE_GETOPT_LONG
# define _GNU_SOURCE
# include <getopt.h>
struct option Opts[] = {
{"all", 0, NULL, 'a'},
{"list", 0, NULL, 'l'},
@ -183,7 +182,7 @@ int
main (int argc, char **argv)
{
int i;
int ret = 1;
int ret;
config_t *box = 0;
mailbox_t *mail = 0;
imap_t *imap = 0;
@ -274,8 +273,7 @@ main (int argc, char **argv)
global.folder = optarg;
break;
case 'M':
free (global.maildir);
global.maildir = strdup (optarg);
global.maildir = optarg;
break;
case 'I':
global.inbox = optarg;
@ -291,7 +289,6 @@ main (int argc, char **argv)
global.host = optarg;
break;
case 'u':
free (global.user);
global.user = optarg;
break;
case 'V':
@ -348,9 +345,9 @@ main (int argc, char **argv)
imap = imap_connect (&global);
if (!imap)
goto bork;
return 1;
if (imap_list (imap))
goto bork;
return 1;
}
if (list)
{
@ -462,12 +459,7 @@ main (int argc, char **argv)
if (all)
box = box->next;
}
/* gracefully close connection to the IMAP server */
imap_close (imap);
bork:
free_config ();
return ret;
}