From 6fc06defd55e7d00f620d40e52da47bc4c1b3a96 Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Thu, 14 Jun 2018 16:50:18 -0600 Subject: * More changes to make Valgrind happy. --- imap/src/c-client/imap4r1.c | 1 + imap/src/c-client/mail.c | 1 + imap/src/c-client/tcp.h | 1 + imap/src/osdep/nt/tcp_nt.c | 8 ++++++++ imap/src/osdep/unix/env_unix.c | 1 + imap/src/osdep/unix/tcp_unix.c | 12 ++++++++++++ imap/src/osdep/unix/unix.c | 33 ++++++++++----------------------- 7 files changed, 34 insertions(+), 23 deletions(-) (limited to 'imap') diff --git a/imap/src/c-client/imap4r1.c b/imap/src/c-client/imap4r1.c index 343e29bf..b20453ee 100644 --- a/imap/src/c-client/imap4r1.c +++ b/imap/src/c-client/imap4r1.c @@ -2951,6 +2951,7 @@ long imap_setid (MAILSTREAM *stream, IDLIST *idlist) if (imap_OK (stream,reply = imap_send (stream,"ID",args))) ret = LONGT; else mm_log (reply->text,ERROR); + if(qroot) fs_give((void **) &qroot); } else mm_log("Empty or malformed ID list", ERROR); } else mm_log ("ID capability not available on this IMAP server",ERROR); diff --git a/imap/src/c-client/mail.c b/imap/src/c-client/mail.c index b18f7732..3dd45eb5 100644 --- a/imap/src/c-client/mail.c +++ b/imap/src/c-client/mail.c @@ -6407,4 +6407,5 @@ char *net_localhost (NETSTREAM *stream) void free_c_client_module_globals(void) { env_end(); + tcp_end(); } diff --git a/imap/src/c-client/tcp.h b/imap/src/c-client/tcp.h index b9f095a8..ecf39bef 100644 --- a/imap/src/c-client/tcp.h +++ b/imap/src/c-client/tcp.h @@ -57,3 +57,4 @@ char *tcp_serverhost (void); long tcp_serverport (void); char *tcp_canonical (char *name); long tcp_isclienthost (char *host); +void tcp_end(void); diff --git a/imap/src/osdep/nt/tcp_nt.c b/imap/src/osdep/nt/tcp_nt.c index aeb05a3e..7af6de77 100644 --- a/imap/src/osdep/nt/tcp_nt.c +++ b/imap/src/osdep/nt/tcp_nt.c @@ -918,3 +918,11 @@ char *tcp_name_valid (char *s) } return ret; } + +void tcp_end(void) +{ + if(myClientAddr) fs_give((void **) &myClientAddr); + if(myClientHost) fs_give((void **) &myClientHost); + if(myServerAddr) fs_give((void **) &myServerAddr); + if(myServerHost) fs_give((void **) &myServerHost); +} diff --git a/imap/src/osdep/unix/env_unix.c b/imap/src/osdep/unix/env_unix.c index 44aed22f..322ab61a 100644 --- a/imap/src/osdep/unix/env_unix.c +++ b/imap/src/osdep/unix/env_unix.c @@ -1857,6 +1857,7 @@ void *mm_blocknotify (int reason,void *data) void env_end(void) { + if(myMailboxDir) fs_give((void **) &myMailboxDir); if(myUserName) fs_give((void **)&myUserName); if(myHomeDir) fs_give((void **)&myHomeDir); if(ftpHome) fs_give((void **)&ftpHome); diff --git a/imap/src/osdep/unix/tcp_unix.c b/imap/src/osdep/unix/tcp_unix.c index 339c968c..b076ce44 100644 --- a/imap/src/osdep/unix/tcp_unix.c +++ b/imap/src/osdep/unix/tcp_unix.c @@ -1066,3 +1066,15 @@ long tcp_isclienthost (char *host) /* Following statement must be at end of this module */ #undef fork /* undo any use of vfork() */ + +void tcp_end(void) +{ + if(rshcommand) fs_give((void **) &rshcommand); + if(rshpath) fs_give((void **) &rshpath); + if(sshcommand) fs_give((void **) &sshcommand); + if(sshpath) fs_give((void **) &sshpath); + if(myClientAddr) fs_give((void **) &myClientAddr); + if(myClientHost) fs_give((void **) &myClientHost); + if(myServerAddr) fs_give((void **) &myServerAddr); + if(myServerHost) fs_give((void **) &myServerHost); +} diff --git a/imap/src/osdep/unix/unix.c b/imap/src/osdep/unix/unix.c index cda5798c..74a1ffa9 100644 --- a/imap/src/osdep/unix/unix.c +++ b/imap/src/osdep/unix/unix.c @@ -21,7 +21,7 @@ * Internet: MRC@Washington.EDU * * Date: 20 December 1989 - * Last Edited: 27 March 2008 + * Last Edited: June 13 2018 by Eduardo Chappa */ @@ -586,8 +586,15 @@ void unix_close (MAILSTREAM *stream,long options) * Returns: message header in RFC822 format */ - /* lines to filter from header */ -static STRINGLIST *unix_hlines = NIL; + +STRINGLIST XIMAPbase = {"X-IMAPbase", 10, NIL}; +STRINGLIST XIMAP = {"X-IMAP", 6, &XIMAPbase}; +STRINGLIST XUID = {"X-UID", 5, &XIMAP}; +STRINGLIST XKeywords = {"X-Keywords", 10, &XUID}; +STRINGLIST XStatus = {"X-Status", 8, &XKeywords}; +STRINGLIST Status = {"Status", 6, &XStatus}; + +static STRINGLIST *unix_hlines = &Status; char *unix_header (MAILSTREAM *stream,unsigned long msgno, unsigned long *length,long flags) @@ -597,26 +604,6 @@ char *unix_header (MAILSTREAM *stream,unsigned long msgno, *length = 0; /* default to empty */ if (flags & FT_UID) return "";/* UID call "impossible" */ elt = mail_elt (stream,msgno);/* get cache */ - if (!unix_hlines) { /* once only code */ - STRINGLIST *lines = unix_hlines = mail_newstringlist (); - lines->text.size = strlen ((char *) (lines->text.data = - (unsigned char *) "Status")); - lines = lines->next = mail_newstringlist (); - lines->text.size = strlen ((char *) (lines->text.data = - (unsigned char *) "X-Status")); - lines = lines->next = mail_newstringlist (); - lines->text.size = strlen ((char *) (lines->text.data = - (unsigned char *) "X-Keywords")); - lines = lines->next = mail_newstringlist (); - lines->text.size = strlen ((char *) (lines->text.data = - (unsigned char *) "X-UID")); - lines = lines->next = mail_newstringlist (); - lines->text.size = strlen ((char *) (lines->text.data = - (unsigned char *) "X-IMAP")); - lines = lines->next = mail_newstringlist (); - lines->text.size = strlen ((char *) (lines->text.data = - (unsigned char *) "X-IMAPbase")); - } /* go to header position */ lseek (LOCAL->fd,elt->private.special.offset + elt->private.msg.header.offset,L_SET); -- cgit v1.2.3-70-g09d2