added memory debugging code
fixed memory leak in free_list() free memory associated with global settings on exit
This commit is contained in:
parent
de1f9e1941
commit
f0c7fdf008
|
@ -1,5 +1,8 @@
|
||||||
bin_PROGRAMS=isync
|
bin_PROGRAMS=isync
|
||||||
isync_SOURCES=main.c imap.c sync.c maildir.c isync.h list.c cram.c config.c
|
isync_SOURCES=main.c imap.c sync.c maildir.c isync.h list.c cram.c config.c
|
||||||
|
isync_LDADD=@DEBUGOBJ@
|
||||||
|
isync_DEPENDENCIES=@DEBUGOBJ@
|
||||||
|
EXTRA_isync_SOURCES=debug.c
|
||||||
man_MANS=isync.1
|
man_MANS=isync.1
|
||||||
EXTRA_DIST=sample.isyncrc $(man_MANS)
|
EXTRA_DIST=sample.isyncrc $(man_MANS)
|
||||||
INCLUDES=$(RPM_OPT_FLAGS)
|
INCLUDES=$(RPM_OPT_FLAGS)
|
||||||
|
|
2
TODO
2
TODO
|
@ -1,7 +1,5 @@
|
||||||
add support for syncing with other: and shared: via NAMESPACE
|
add support for syncing with other: and shared: via NAMESPACE
|
||||||
|
|
||||||
finish implementing --quiet
|
|
||||||
|
|
||||||
--fast downloads the last message again if no new messages have arrived
|
--fast downloads the last message again if no new messages have arrived
|
||||||
|
|
||||||
isync gets confused when new mail is delivered while in the middle of an
|
isync gets confused when new mail is delivered while in the middle of an
|
||||||
|
|
17
config.c
17
config.c
|
@ -18,8 +18,6 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _GNU_SOURCE 1
|
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@ -39,16 +37,14 @@ config_defaults (config_t * conf)
|
||||||
memcpy (conf, &global, sizeof (config_t));
|
memcpy (conf, &global, sizeof (config_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HAVE_STRNDUP
|
|
||||||
static char *
|
static char *
|
||||||
strndup (const char *s, size_t nchars)
|
my_strndup (const char *s, size_t nchars)
|
||||||
{
|
{
|
||||||
char *r = malloc (sizeof (char) * (nchars + 1));
|
char *r = malloc (sizeof (char) * (nchars + 1));
|
||||||
strncpy (r, s, nchars);
|
strncpy (r, s, nchars);
|
||||||
r[nchars] = 0;
|
r[nchars] = 0;
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
#endif /* ! HAVE_STRNDUP */
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
expand_strdup (const char *s)
|
expand_strdup (const char *s)
|
||||||
|
@ -73,7 +69,7 @@ expand_strdup (const char *s)
|
||||||
p = strchr (s, '/');
|
p = strchr (s, '/');
|
||||||
if (p)
|
if (p)
|
||||||
{
|
{
|
||||||
user = strndup (s, (int)(p - s));
|
user = my_strndup (s, (int)(p - s));
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -324,3 +320,12 @@ find_box (const char *s)
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
free_config (void)
|
||||||
|
{
|
||||||
|
free (global.user);
|
||||||
|
free (global.maildir);
|
||||||
|
free (global.host);
|
||||||
|
free (global.pass);
|
||||||
|
}
|
||||||
|
|
|
@ -8,7 +8,13 @@ AC_ARG_WITH(ssl-dir, [ --with-ssl-dir=DIR location where openssl is insalled],
|
||||||
else
|
else
|
||||||
AC_MSG_ERROR(can't find OpenSSL in $withval)
|
AC_MSG_ERROR(can't find OpenSSL in $withval)
|
||||||
fi])
|
fi])
|
||||||
AC_CHECK_FUNCS(getopt_long strndup)
|
AC_ARG_ENABLE(debug, [ --enable-debug enable memory debugging
|
||||||
|
code],
|
||||||
|
[AC_DEFINE(DEBUG),
|
||||||
|
DEBUGOBJ=debug.o],
|
||||||
|
[DEBUGOBJ=''])
|
||||||
|
AC_SUBST(DEBUGOBJ)
|
||||||
|
AC_CHECK_FUNCS(getopt_long)
|
||||||
AC_CHECK_LIB(socket,socket)
|
AC_CHECK_LIB(socket,socket)
|
||||||
AC_CHECK_LIB(nsl,inet_ntoa)
|
AC_CHECK_LIB(nsl,inet_ntoa)
|
||||||
AC_CHECK_LIB(crypto,ERR_error_string)
|
AC_CHECK_LIB(crypto,ERR_error_string)
|
||||||
|
|
2
isync.h
2
isync.h
|
@ -23,6 +23,7 @@
|
||||||
#if HAVE_LIBSSL
|
#if HAVE_LIBSSL
|
||||||
#include <openssl/ssl.h>
|
#include <openssl/ssl.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -173,6 +174,7 @@ int sync_mailbox (mailbox_t *, imap_t *, int, unsigned int, unsigned int);
|
||||||
void load_config (const char *);
|
void load_config (const char *);
|
||||||
char * expand_strdup (const char *s);
|
char * expand_strdup (const char *s);
|
||||||
config_t *find_box (const char *);
|
config_t *find_box (const char *);
|
||||||
|
void free_config (void);
|
||||||
|
|
||||||
void imap_close (imap_t *);
|
void imap_close (imap_t *);
|
||||||
int imap_copy_message (imap_t * imap, unsigned int uid, const char *mailbox);
|
int imap_copy_message (imap_t * imap, unsigned int uid, const char *mailbox);
|
||||||
|
|
2
list.c
2
list.c
|
@ -153,7 +153,7 @@ free_list (list_t * list)
|
||||||
{
|
{
|
||||||
tmp = list;
|
tmp = list;
|
||||||
list = list->next;
|
list = list->next;
|
||||||
if (is_list (list))
|
if (is_list (tmp))
|
||||||
free_list (tmp->child);
|
free_list (tmp->child);
|
||||||
else if (is_atom (tmp))
|
else if (is_atom (tmp))
|
||||||
free (tmp->val);
|
free (tmp->val);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user