summaryrefslogtreecommitdiff
path: root/alpine
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2018-05-13 01:38:56 -0600
committerEduardo Chappa <chappa@washington.edu>2018-05-13 01:38:56 -0600
commitaac7b10863bcfabe936feb5151e7e11123e13306 (patch)
tree8033a31daed6c94fcbdd41eef1682ba0539cfabd /alpine
parent400647dcc1b040f82d22d539fc013f5e23132049 (diff)
downloadalpine-aac7b10863bcfabe936feb5151e7e11123e13306.tar.xz
* More changes to make Valgrind happy. Work in progress.
Diffstat (limited to 'alpine')
-rw-r--r--alpine/alpine.c14
-rw-r--r--alpine/imap.c24
-rw-r--r--alpine/imap.h3
-rw-r--r--alpine/send.c4
-rw-r--r--alpine/status.c20
-rw-r--r--alpine/status.h1
6 files changed, 61 insertions, 5 deletions
diff --git a/alpine/alpine.c b/alpine/alpine.c
index d762059b..c5f64d74 100644
--- a/alpine/alpine.c
+++ b/alpine/alpine.c
@@ -97,6 +97,7 @@ void pine_read_progress(GETS_DATA *, unsigned long);
int remote_pinerc_failure(void);
void dump_supported_options(void);
int prune_folders_ok(void);
+void free_alpine_module_globals(void);
#ifdef WIN32
char *pine_user_callback(void);
#endif
@@ -3293,6 +3294,11 @@ goodnight_gracey(struct pine *pine_state, int exit_val)
free_histlist();
+ free_alpine_module_globals(); /* should we have module globals? */
+ free_pith_module_globals();
+ free_pico_module_globals();
+ free_c_client_module_globals();
+
#ifdef DEBUG
if(debugfile){
if(debug >= 2)
@@ -3538,6 +3544,14 @@ prune_folders_ok(void)
return(1);
}
+void
+free_alpine_module_globals(void)
+{
+#ifdef LOCAL_PASSWD_CACHE
+ free_passfile_cache();
+#endif
+ free_message_queue();
+}
#ifdef WIN32
char *
diff --git a/alpine/imap.c b/alpine/imap.c
index 5b107600..48ee3606 100644
--- a/alpine/imap.c
+++ b/alpine/imap.c
@@ -106,6 +106,7 @@ int read_passfile(char *, MMLOGIN_S **);
void write_passfile(char *, MMLOGIN_S *);
int preserve_prompt(char *);
void update_passfile_hostlist(char *, char *, STRLIST_S *, int);
+void free_passfile_cache_work(MMLOGIN_S **);
static MMLOGIN_S *passfile_cache = NULL;
static int using_passfile = -1;
@@ -2713,8 +2714,29 @@ get_passfile_passwd(pinerc, passwd, user, hostlist, altflag)
: 0);
}
+void
+free_passfile_cache_work(MMLOGIN_S **pwdcache)
+{
+ if(pwdcache == NULL || *pwdcache == NULL)
+ return;
+
+ if((*pwdcache)->user) fs_give((void **)&(*pwdcache)->user);
+// if((*pwdcache)->passwd) fs_give((void **)&(*pwdcache)->passwd);
+ if((*pwdcache)->hosts) free_strlist(&(*pwdcache)->hosts);
+ free_passfile_cache_work(&(*pwdcache)->next);
+ fs_give((void **)pwdcache);
+}
+
+
+void
+free_passfile_cache(void)
+{
+ if(passfile_cache)
+ free_passfile_cache_work(&passfile_cache);
+}
+
int
-is_using_passfile()
+is_using_passfile(void)
{
return(using_passfile == 1);
}
diff --git a/alpine/imap.h b/alpine/imap.h
index bd5960f0..08f51ce5 100644
--- a/alpine/imap.h
+++ b/alpine/imap.h
@@ -34,9 +34,10 @@ void mm_expunged_current(long unsigned int);
#ifdef LOCAL_PASSWD_CACHE
int get_passfile_passwd(char *, char *, char *, STRLIST_S *, int);
-int is_using_passfile();
+int is_using_passfile(void);
void set_passfile_passwd(char *, char *, char *, STRLIST_S *, int, int);
char *get_passfile_user(char *, STRLIST_S *);
+void free_passfile_cache(void);
#endif /* LOCAL_PASSWD_CACHE */
#if (WINCRED > 0)
diff --git a/alpine/send.c b/alpine/send.c
index c7763bfd..496824f4 100644
--- a/alpine/send.c
+++ b/alpine/send.c
@@ -2170,9 +2170,7 @@ pine_send(ENVELOPE *outgoing, struct mail_bodystruct **body,
pf->name = cpystr(pf_template[index].name);
if(index == N_SENDER && F_ON(F_USE_SENDER_NOT_X, ps_global))
/* slide string over so it is Sender instead of X-X-Sender */
- for(p=pf->name; *(p+1); p++)
- *p = *(p+4);
-
+ memmove(pf->name, pf->name+4, strlen(pf->name)-4+1);
pf->type = pf_template[index].type;
pf->canedit = pf_template[index].canedit;
pf->rcptto = pf_template[index].rcptto;
diff --git a/alpine/status.c b/alpine/status.c
index ab24c71d..1c5d3595 100644
--- a/alpine/status.c
+++ b/alpine/status.c
@@ -1280,3 +1280,23 @@ modal_bogus_input(UCS ch)
Writechar(BELL, 0);
return(0);
}
+
+void
+free_message_queue(void)
+{
+ SMQ_T *m, *mnext;
+
+ if(message_queue == NULL)
+ return;
+
+ m = message_queue;
+ do{
+ if(m->text)
+ fs_give((void **) &m->text);
+
+ mnext = m->next;
+ fs_give((void **) &m);
+ m = mnext;
+ } while(m != message_queue);
+ message_queue = NULL;
+}
diff --git a/alpine/status.h b/alpine/status.h
index 240c4f91..45f0a36b 100644
--- a/alpine/status.h
+++ b/alpine/status.h
@@ -28,6 +28,7 @@ void flush_ordered_messages(void);
int status_message_write(char *, int);
void mark_status_dirty(void);
void mark_status_unknown(void);
+void free_message_queue(void);
#endif /* PINE_STATUS_INCLUDED */