-rw-r--r-- | noncore/net/mail/genericwrapper.cpp | 6 | ||||
-rw-r--r-- | noncore/net/mail/imapwrapper.cpp | 12 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/genericwrapper.cpp | 6 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 12 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailwrapper.cpp | 2 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mboxwrapper.cpp | 12 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/smtpwrapper.cpp | 33 | ||||
-rw-r--r-- | noncore/net/mail/mailwrapper.cpp | 2 | ||||
-rw-r--r-- | noncore/net/mail/mboxwrapper.cpp | 12 | ||||
-rw-r--r-- | noncore/net/mail/smtpwrapper.cpp | 33 |
10 files changed, 84 insertions, 46 deletions
diff --git a/noncore/net/mail/genericwrapper.cpp b/noncore/net/mail/genericwrapper.cpp index 447cad0..c1b6e48 100644 --- a/noncore/net/mail/genericwrapper.cpp +++ b/noncore/net/mail/genericwrapper.cpp @@ -193,5 +193,5 @@ RecMail *Genericwrapper::parseHeader( const char *header ) RecMail *mail = new RecMail(); - mailimf_fields *fields; - mailimf_references * refs; - mailimf_keywords*keys; + mailimf_fields *fields = 0; + mailimf_references * refs = 0; + mailimf_keywords*keys = 0; QString status; diff --git a/noncore/net/mail/imapwrapper.cpp b/noncore/net/mail/imapwrapper.cpp index 853e4a2..0178e33 100644 --- a/noncore/net/mail/imapwrapper.cpp +++ b/noncore/net/mail/imapwrapper.cpp @@ -96,9 +96,9 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) { - const char *mb; + const char *mb = 0; int err = MAILIMAP_NO_ERROR; - clist *result; + clist *result = 0; clistcell *current; // mailimap_fetch_att *fetchAtt,*fetchAttFlags,*fetchAttDate,*fetchAttSize; - mailimap_fetch_type *fetchType; - mailimap_set *set; + mailimap_fetch_type *fetchType = 0; + mailimap_set *set = 0; @@ -123,3 +123,2 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) - result = clist_new(); /* the range has to start at 1!!! not with 0!!!! */ @@ -139,3 +138,2 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) if ( err == MAILIMAP_NO_ERROR ) { - mailimap_msg_att * msg_att; @@ -156,3 +154,3 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) } - mailimap_fetch_list_free(result); + if (result) mailimap_fetch_list_free(result); } diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp index 447cad0..c1b6e48 100644 --- a/noncore/net/mail/libmailwrapper/genericwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp @@ -193,5 +193,5 @@ RecMail *Genericwrapper::parseHeader( const char *header ) RecMail *mail = new RecMail(); - mailimf_fields *fields; - mailimf_references * refs; - mailimf_keywords*keys; + mailimf_fields *fields = 0; + mailimf_references * refs = 0; + mailimf_keywords*keys = 0; QString status; diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index 853e4a2..0178e33 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp @@ -96,9 +96,9 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) { - const char *mb; + const char *mb = 0; int err = MAILIMAP_NO_ERROR; - clist *result; + clist *result = 0; clistcell *current; // mailimap_fetch_att *fetchAtt,*fetchAttFlags,*fetchAttDate,*fetchAttSize; - mailimap_fetch_type *fetchType; - mailimap_set *set; + mailimap_fetch_type *fetchType = 0; + mailimap_set *set = 0; @@ -123,3 +123,2 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) - result = clist_new(); /* the range has to start at 1!!! not with 0!!!! */ @@ -139,3 +138,2 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) if ( err == MAILIMAP_NO_ERROR ) { - mailimap_msg_att * msg_att; @@ -156,3 +154,3 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) } - mailimap_fetch_list_free(result); + if (result) mailimap_fetch_list_free(result); } diff --git a/noncore/net/mail/libmailwrapper/mailwrapper.cpp b/noncore/net/mail/libmailwrapper/mailwrapper.cpp index f8efd09..6479783 100644 --- a/noncore/net/mail/libmailwrapper/mailwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mailwrapper.cpp @@ -57,3 +57,3 @@ QString IMAPFolder::decodeFolderName( const QString &name ) unsigned long srcPtr = 0; - QCString dst; + QCString dst = ""; QCString src = name.ascii(); diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp index 293ae1b..6d69263 100644 --- a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp @@ -6,2 +6,3 @@ #include <qdir.h> +#include <stdlib.h> @@ -25,6 +26,9 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) p+=mailbox; + char*fname = 0; - int r = mbox_mailstorage_init(storage,strdup(p.latin1()),0,0,0); + fname = strdup(p.latin1()); + + int r = mbox_mailstorage_init(storage,fname,0,0,0); mailfolder*folder; - folder = mailfolder_new( storage,strdup(p.latin1()),NULL); + folder = mailfolder_new( storage,fname,NULL); r = mailfolder_connect(folder); @@ -34,2 +38,3 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) mailstorage_free(storage); + free(fname); return; @@ -42,2 +47,3 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) mailstorage_free(storage); + free(fname); return; @@ -52,2 +58,3 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) mailstorage_free(storage); + free(fname); return; @@ -105,2 +112,3 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) mailstorage_free(storage); + free(fname); } diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp index a7e4837..21992b4 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp @@ -443,3 +443,5 @@ char *SMTPwrapper::getFrom( mailmime *mail ) { + /* no need to delete - its just a pointer to structure content */ mailimf_field *ffrom = 0; + char*f = 0; ffrom = getField( mail->mm_data.mm_message.mm_fields, MAILIMF_FIELD_FROM ); @@ -565,2 +567,5 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ) smtpSend(from,rcpts,data,size,smtp); + if (data) {free(data);} + if (from) {free(from);} + if (rcpts) smtp_address_list_free( rcpts ); } @@ -632,6 +637,3 @@ free_mem_session: free_mem: - if (rcpts) smtp_address_list_free( rcpts ); - if (data) free( data ); if (server) free( server ); - if (from) free( from ); if ( smtp->getLogin() ) { @@ -654,3 +656,2 @@ void SMTPwrapper::sendMail(const Mail&mail,bool later ) sendProgress = new progressMailSend(); -// sendProgress->showMaximized(); sendProgress->show(); @@ -675,2 +676,3 @@ int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) char*from = 0; + int res = 0; @@ -691,5 +693,18 @@ int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) if (rcpts && from) { - return smtpSend(from,rcpts,data,strlen(data),smtp ); + res = smtpSend(from,rcpts,data,length,smtp ); } - return 0; + if (fields) { + mailimf_fields_free(fields); + fields = 0; + } + if (data) { + free(data); + } + if (from) { + free(from); + } + if (rcpts) { + smtp_address_list_free( rcpts ); + } + return res; } @@ -719,5 +734,4 @@ bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) sendProgress = new progressMailSend(); -// sendProgress->showMaximized(); - sendProgress->show(); - sendProgress->setMaxMails(mailsToSend.count()); + sendProgress->show(); + sendProgress->setMaxMails(mailsToSend.count()); @@ -742,3 +756,2 @@ bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) return returnValue; - } diff --git a/noncore/net/mail/mailwrapper.cpp b/noncore/net/mail/mailwrapper.cpp index f8efd09..6479783 100644 --- a/noncore/net/mail/mailwrapper.cpp +++ b/noncore/net/mail/mailwrapper.cpp @@ -57,3 +57,3 @@ QString IMAPFolder::decodeFolderName( const QString &name ) unsigned long srcPtr = 0; - QCString dst; + QCString dst = ""; QCString src = name.ascii(); diff --git a/noncore/net/mail/mboxwrapper.cpp b/noncore/net/mail/mboxwrapper.cpp index 293ae1b..6d69263 100644 --- a/noncore/net/mail/mboxwrapper.cpp +++ b/noncore/net/mail/mboxwrapper.cpp @@ -6,2 +6,3 @@ #include <qdir.h> +#include <stdlib.h> @@ -25,6 +26,9 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) p+=mailbox; + char*fname = 0; - int r = mbox_mailstorage_init(storage,strdup(p.latin1()),0,0,0); + fname = strdup(p.latin1()); + + int r = mbox_mailstorage_init(storage,fname,0,0,0); mailfolder*folder; - folder = mailfolder_new( storage,strdup(p.latin1()),NULL); + folder = mailfolder_new( storage,fname,NULL); r = mailfolder_connect(folder); @@ -34,2 +38,3 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) mailstorage_free(storage); + free(fname); return; @@ -42,2 +47,3 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) mailstorage_free(storage); + free(fname); return; @@ -52,2 +58,3 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) mailstorage_free(storage); + free(fname); return; @@ -105,2 +112,3 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) mailstorage_free(storage); + free(fname); } diff --git a/noncore/net/mail/smtpwrapper.cpp b/noncore/net/mail/smtpwrapper.cpp index a7e4837..21992b4 100644 --- a/noncore/net/mail/smtpwrapper.cpp +++ b/noncore/net/mail/smtpwrapper.cpp @@ -443,3 +443,5 @@ char *SMTPwrapper::getFrom( mailmime *mail ) { + /* no need to delete - its just a pointer to structure content */ mailimf_field *ffrom = 0; + char*f = 0; ffrom = getField( mail->mm_data.mm_message.mm_fields, MAILIMF_FIELD_FROM ); @@ -565,2 +567,5 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ) smtpSend(from,rcpts,data,size,smtp); + if (data) {free(data);} + if (from) {free(from);} + if (rcpts) smtp_address_list_free( rcpts ); } @@ -632,6 +637,3 @@ free_mem_session: free_mem: - if (rcpts) smtp_address_list_free( rcpts ); - if (data) free( data ); if (server) free( server ); - if (from) free( from ); if ( smtp->getLogin() ) { @@ -654,3 +656,2 @@ void SMTPwrapper::sendMail(const Mail&mail,bool later ) sendProgress = new progressMailSend(); -// sendProgress->showMaximized(); sendProgress->show(); @@ -675,2 +676,3 @@ int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) char*from = 0; + int res = 0; @@ -691,5 +693,18 @@ int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) if (rcpts && from) { - return smtpSend(from,rcpts,data,strlen(data),smtp ); + res = smtpSend(from,rcpts,data,length,smtp ); } - return 0; + if (fields) { + mailimf_fields_free(fields); + fields = 0; + } + if (data) { + free(data); + } + if (from) { + free(from); + } + if (rcpts) { + smtp_address_list_free( rcpts ); + } + return res; } @@ -719,5 +734,4 @@ bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) sendProgress = new progressMailSend(); -// sendProgress->showMaximized(); - sendProgress->show(); - sendProgress->setMaxMails(mailsToSend.count()); + sendProgress->show(); + sendProgress->setMaxMails(mailsToSend.count()); @@ -742,3 +756,2 @@ bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) return returnValue; - } |