author | alwin <alwin> | 2003-12-24 14:18:28 (UTC) |
---|---|---|
committer | alwin <alwin> | 2003-12-24 14:18:28 (UTC) |
commit | 9d2a848b254d6c859d7054d486eedac6535d26ec (patch) (unidiff) | |
tree | d3cb3479465b1cc6ef4b67898fc9649f8416c3da | |
parent | c609fd3341bccf6150e313f4fa08ff3ca9086503 (diff) | |
download | opie-9d2a848b254d6c859d7054d486eedac6535d26ec.zip opie-9d2a848b254d6c859d7054d486eedac6535d26ec.tar.gz opie-9d2a848b254d6c859d7054d486eedac6535d26ec.tar.bz2 |
hopefully fixed some memleaks and some not initialized vars
-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 ) | |||
193 | RecMail *mail = new RecMail(); | 193 | RecMail *mail = new RecMail(); |
194 | mailimf_fields *fields; | 194 | mailimf_fields *fields = 0; |
195 | mailimf_references * refs; | 195 | mailimf_references * refs = 0; |
196 | mailimf_keywords*keys; | 196 | mailimf_keywords*keys = 0; |
197 | QString status; | 197 | 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 ) | |||
96 | { | 96 | { |
97 | const char *mb; | 97 | const char *mb = 0; |
98 | int err = MAILIMAP_NO_ERROR; | 98 | int err = MAILIMAP_NO_ERROR; |
99 | clist *result; | 99 | clist *result = 0; |
100 | clistcell *current; | 100 | clistcell *current; |
101 | // mailimap_fetch_att *fetchAtt,*fetchAttFlags,*fetchAttDate,*fetchAttSize; | 101 | // mailimap_fetch_att *fetchAtt,*fetchAttFlags,*fetchAttDate,*fetchAttSize; |
102 | mailimap_fetch_type *fetchType; | 102 | mailimap_fetch_type *fetchType = 0; |
103 | mailimap_set *set; | 103 | mailimap_set *set = 0; |
104 | 104 | ||
@@ -123,3 +123,2 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
123 | 123 | ||
124 | result = clist_new(); | ||
125 | /* the range has to start at 1!!! not with 0!!!! */ | 124 | /* the range has to start at 1!!! not with 0!!!! */ |
@@ -139,3 +138,2 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
139 | if ( err == MAILIMAP_NO_ERROR ) { | 138 | if ( err == MAILIMAP_NO_ERROR ) { |
140 | |||
141 | mailimap_msg_att * msg_att; | 139 | mailimap_msg_att * msg_att; |
@@ -156,3 +154,3 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
156 | } | 154 | } |
157 | mailimap_fetch_list_free(result); | 155 | if (result) mailimap_fetch_list_free(result); |
158 | } | 156 | } |
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 ) | |||
193 | RecMail *mail = new RecMail(); | 193 | RecMail *mail = new RecMail(); |
194 | mailimf_fields *fields; | 194 | mailimf_fields *fields = 0; |
195 | mailimf_references * refs; | 195 | mailimf_references * refs = 0; |
196 | mailimf_keywords*keys; | 196 | mailimf_keywords*keys = 0; |
197 | QString status; | 197 | 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 ) | |||
96 | { | 96 | { |
97 | const char *mb; | 97 | const char *mb = 0; |
98 | int err = MAILIMAP_NO_ERROR; | 98 | int err = MAILIMAP_NO_ERROR; |
99 | clist *result; | 99 | clist *result = 0; |
100 | clistcell *current; | 100 | clistcell *current; |
101 | // mailimap_fetch_att *fetchAtt,*fetchAttFlags,*fetchAttDate,*fetchAttSize; | 101 | // mailimap_fetch_att *fetchAtt,*fetchAttFlags,*fetchAttDate,*fetchAttSize; |
102 | mailimap_fetch_type *fetchType; | 102 | mailimap_fetch_type *fetchType = 0; |
103 | mailimap_set *set; | 103 | mailimap_set *set = 0; |
104 | 104 | ||
@@ -123,3 +123,2 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
123 | 123 | ||
124 | result = clist_new(); | ||
125 | /* the range has to start at 1!!! not with 0!!!! */ | 124 | /* the range has to start at 1!!! not with 0!!!! */ |
@@ -139,3 +138,2 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
139 | if ( err == MAILIMAP_NO_ERROR ) { | 138 | if ( err == MAILIMAP_NO_ERROR ) { |
140 | |||
141 | mailimap_msg_att * msg_att; | 139 | mailimap_msg_att * msg_att; |
@@ -156,3 +154,3 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
156 | } | 154 | } |
157 | mailimap_fetch_list_free(result); | 155 | if (result) mailimap_fetch_list_free(result); |
158 | } | 156 | } |
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 ) | |||
57 | unsigned long srcPtr = 0; | 57 | unsigned long srcPtr = 0; |
58 | QCString dst; | 58 | QCString dst = ""; |
59 | QCString src = name.ascii(); | 59 | 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 @@ | |||
6 | #include <qdir.h> | 6 | #include <qdir.h> |
7 | #include <stdlib.h> | ||
7 | 8 | ||
@@ -25,6 +26,9 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | |||
25 | p+=mailbox; | 26 | p+=mailbox; |
27 | char*fname = 0; | ||
26 | 28 | ||
27 | int r = mbox_mailstorage_init(storage,strdup(p.latin1()),0,0,0); | 29 | fname = strdup(p.latin1()); |
30 | |||
31 | int r = mbox_mailstorage_init(storage,fname,0,0,0); | ||
28 | mailfolder*folder; | 32 | mailfolder*folder; |
29 | folder = mailfolder_new( storage,strdup(p.latin1()),NULL); | 33 | folder = mailfolder_new( storage,fname,NULL); |
30 | r = mailfolder_connect(folder); | 34 | r = mailfolder_connect(folder); |
@@ -34,2 +38,3 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | |||
34 | mailstorage_free(storage); | 38 | mailstorage_free(storage); |
39 | free(fname); | ||
35 | return; | 40 | return; |
@@ -42,2 +47,3 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | |||
42 | mailstorage_free(storage); | 47 | mailstorage_free(storage); |
48 | free(fname); | ||
43 | return; | 49 | return; |
@@ -52,2 +58,3 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | |||
52 | mailstorage_free(storage); | 58 | mailstorage_free(storage); |
59 | free(fname); | ||
53 | return; | 60 | return; |
@@ -105,2 +112,3 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | |||
105 | mailstorage_free(storage); | 112 | mailstorage_free(storage); |
113 | free(fname); | ||
106 | } | 114 | } |
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 ) | |||
443 | { | 443 | { |
444 | /* no need to delete - its just a pointer to structure content */ | ||
444 | mailimf_field *ffrom = 0; | 445 | mailimf_field *ffrom = 0; |
446 | char*f = 0; | ||
445 | ffrom = getField( mail->mm_data.mm_message.mm_fields, MAILIMF_FIELD_FROM ); | 447 | 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 ) | |||
565 | smtpSend(from,rcpts,data,size,smtp); | 567 | smtpSend(from,rcpts,data,size,smtp); |
568 | if (data) {free(data);} | ||
569 | if (from) {free(from);} | ||
570 | if (rcpts) smtp_address_list_free( rcpts ); | ||
566 | } | 571 | } |
@@ -632,6 +637,3 @@ free_mem_session: | |||
632 | free_mem: | 637 | free_mem: |
633 | if (rcpts) smtp_address_list_free( rcpts ); | ||
634 | if (data) free( data ); | ||
635 | if (server) free( server ); | 638 | if (server) free( server ); |
636 | if (from) free( from ); | ||
637 | if ( smtp->getLogin() ) { | 639 | if ( smtp->getLogin() ) { |
@@ -654,3 +656,2 @@ void SMTPwrapper::sendMail(const Mail&mail,bool later ) | |||
654 | sendProgress = new progressMailSend(); | 656 | sendProgress = new progressMailSend(); |
655 | // sendProgress->showMaximized(); | ||
656 | sendProgress->show(); | 657 | sendProgress->show(); |
@@ -675,2 +676,3 @@ int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) | |||
675 | char*from = 0; | 676 | char*from = 0; |
677 | int res = 0; | ||
676 | 678 | ||
@@ -691,5 +693,18 @@ int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) | |||
691 | if (rcpts && from) { | 693 | if (rcpts && from) { |
692 | return smtpSend(from,rcpts,data,strlen(data),smtp ); | 694 | res = smtpSend(from,rcpts,data,length,smtp ); |
693 | } | 695 | } |
694 | return 0; | 696 | if (fields) { |
697 | mailimf_fields_free(fields); | ||
698 | fields = 0; | ||
699 | } | ||
700 | if (data) { | ||
701 | free(data); | ||
702 | } | ||
703 | if (from) { | ||
704 | free(from); | ||
705 | } | ||
706 | if (rcpts) { | ||
707 | smtp_address_list_free( rcpts ); | ||
708 | } | ||
709 | return res; | ||
695 | } | 710 | } |
@@ -719,5 +734,4 @@ bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) | |||
719 | sendProgress = new progressMailSend(); | 734 | sendProgress = new progressMailSend(); |
720 | // sendProgress->showMaximized(); | 735 | sendProgress->show(); |
721 | sendProgress->show(); | 736 | sendProgress->setMaxMails(mailsToSend.count()); |
722 | sendProgress->setMaxMails(mailsToSend.count()); | ||
723 | 737 | ||
@@ -742,3 +756,2 @@ bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) | |||
742 | return returnValue; | 756 | return returnValue; |
743 | |||
744 | } | 757 | } |
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 ) | |||
57 | unsigned long srcPtr = 0; | 57 | unsigned long srcPtr = 0; |
58 | QCString dst; | 58 | QCString dst = ""; |
59 | QCString src = name.ascii(); | 59 | 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 @@ | |||
6 | #include <qdir.h> | 6 | #include <qdir.h> |
7 | #include <stdlib.h> | ||
7 | 8 | ||
@@ -25,6 +26,9 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | |||
25 | p+=mailbox; | 26 | p+=mailbox; |
27 | char*fname = 0; | ||
26 | 28 | ||
27 | int r = mbox_mailstorage_init(storage,strdup(p.latin1()),0,0,0); | 29 | fname = strdup(p.latin1()); |
30 | |||
31 | int r = mbox_mailstorage_init(storage,fname,0,0,0); | ||
28 | mailfolder*folder; | 32 | mailfolder*folder; |
29 | folder = mailfolder_new( storage,strdup(p.latin1()),NULL); | 33 | folder = mailfolder_new( storage,fname,NULL); |
30 | r = mailfolder_connect(folder); | 34 | r = mailfolder_connect(folder); |
@@ -34,2 +38,3 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | |||
34 | mailstorage_free(storage); | 38 | mailstorage_free(storage); |
39 | free(fname); | ||
35 | return; | 40 | return; |
@@ -42,2 +47,3 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | |||
42 | mailstorage_free(storage); | 47 | mailstorage_free(storage); |
48 | free(fname); | ||
43 | return; | 49 | return; |
@@ -52,2 +58,3 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | |||
52 | mailstorage_free(storage); | 58 | mailstorage_free(storage); |
59 | free(fname); | ||
53 | return; | 60 | return; |
@@ -105,2 +112,3 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) | |||
105 | mailstorage_free(storage); | 112 | mailstorage_free(storage); |
113 | free(fname); | ||
106 | } | 114 | } |
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 ) | |||
443 | { | 443 | { |
444 | /* no need to delete - its just a pointer to structure content */ | ||
444 | mailimf_field *ffrom = 0; | 445 | mailimf_field *ffrom = 0; |
446 | char*f = 0; | ||
445 | ffrom = getField( mail->mm_data.mm_message.mm_fields, MAILIMF_FIELD_FROM ); | 447 | 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 ) | |||
565 | smtpSend(from,rcpts,data,size,smtp); | 567 | smtpSend(from,rcpts,data,size,smtp); |
568 | if (data) {free(data);} | ||
569 | if (from) {free(from);} | ||
570 | if (rcpts) smtp_address_list_free( rcpts ); | ||
566 | } | 571 | } |
@@ -632,6 +637,3 @@ free_mem_session: | |||
632 | free_mem: | 637 | free_mem: |
633 | if (rcpts) smtp_address_list_free( rcpts ); | ||
634 | if (data) free( data ); | ||
635 | if (server) free( server ); | 638 | if (server) free( server ); |
636 | if (from) free( from ); | ||
637 | if ( smtp->getLogin() ) { | 639 | if ( smtp->getLogin() ) { |
@@ -654,3 +656,2 @@ void SMTPwrapper::sendMail(const Mail&mail,bool later ) | |||
654 | sendProgress = new progressMailSend(); | 656 | sendProgress = new progressMailSend(); |
655 | // sendProgress->showMaximized(); | ||
656 | sendProgress->show(); | 657 | sendProgress->show(); |
@@ -675,2 +676,3 @@ int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) | |||
675 | char*from = 0; | 676 | char*from = 0; |
677 | int res = 0; | ||
676 | 678 | ||
@@ -691,5 +693,18 @@ int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) | |||
691 | if (rcpts && from) { | 693 | if (rcpts && from) { |
692 | return smtpSend(from,rcpts,data,strlen(data),smtp ); | 694 | res = smtpSend(from,rcpts,data,length,smtp ); |
693 | } | 695 | } |
694 | return 0; | 696 | if (fields) { |
697 | mailimf_fields_free(fields); | ||
698 | fields = 0; | ||
699 | } | ||
700 | if (data) { | ||
701 | free(data); | ||
702 | } | ||
703 | if (from) { | ||
704 | free(from); | ||
705 | } | ||
706 | if (rcpts) { | ||
707 | smtp_address_list_free( rcpts ); | ||
708 | } | ||
709 | return res; | ||
695 | } | 710 | } |
@@ -719,5 +734,4 @@ bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) | |||
719 | sendProgress = new progressMailSend(); | 734 | sendProgress = new progressMailSend(); |
720 | // sendProgress->showMaximized(); | 735 | sendProgress->show(); |
721 | sendProgress->show(); | 736 | sendProgress->setMaxMails(mailsToSend.count()); |
722 | sendProgress->setMaxMails(mailsToSend.count()); | ||
723 | 737 | ||
@@ -742,3 +756,2 @@ bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) | |||
742 | return returnValue; | 756 | return returnValue; |
743 | |||
744 | } | 757 | } |