From aac7b10863bcfabe936feb5151e7e11123e13306 Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Sun, 13 May 2018 01:38:56 -0600 Subject: * More changes to make Valgrind happy. Work in progress. --- alpine/imap.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'alpine/imap.c') 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); } -- cgit v1.2.3-54-g00ecf