git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@460 77e5149b-7576-45b1-b177-96237e5ba77b
Nigel Horne authored on 2004/04/01 02:01:18... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Wed Mar 31 18:12:20 BST 2004 (njh) |
|
2 |
+---------------------------------- |
|
3 |
+ * libclamav: Code tidy up - free memory earlier |
|
4 |
+ |
|
1 | 5 |
Wed Mar 31 09:25:25 CEST 2004 (tk) |
2 | 6 |
---------------------------------- |
3 | 7 |
* libclamav: matcher: don't limit '*' to a single 128KB buffer |
... | ... |
@@ -17,6 +17,9 @@ |
17 | 17 |
* |
18 | 18 |
* Change History: |
19 | 19 |
* $Log: mbox.c,v $ |
20 |
+ * Revision 1.62 2004/03/31 17:00:20 nigelhorne |
|
21 |
+ * Code tidy up free memory earlier |
|
22 |
+ * |
|
20 | 23 |
* Revision 1.61 2004/03/30 22:45:13 nigelhorne |
21 | 24 |
* Better handling of multipart/multipart messages |
22 | 25 |
* |
... | ... |
@@ -174,7 +177,7 @@ |
174 | 174 |
* Compilable under SCO; removed duplicate code with message.c |
175 | 175 |
* |
176 | 176 |
*/ |
177 |
-static char const rcsid[] = "$Id: mbox.c,v 1.61 2004/03/30 22:45:13 nigelhorne Exp $"; |
|
177 |
+static char const rcsid[] = "$Id: mbox.c,v 1.62 2004/03/31 17:00:20 nigelhorne Exp $"; |
|
178 | 178 |
|
179 | 179 |
#if HAVE_CONFIG_H |
180 | 180 |
#include "clamav-config.h" |
... | ... |
@@ -800,12 +803,17 @@ parseEmailBody(message *messageIn, blob **blobsIn, int nBlobs, text *textIn, con |
800 | 800 |
|
801 | 801 |
free((char *)boundary); |
802 | 802 |
|
803 |
- if(multiparts == 0) { |
|
804 |
- if(mainMessage && (mainMessage != messageIn)) |
|
805 |
- messageDestroy(mainMessage); |
|
806 |
- return 2; /* Nothing to do */ |
|
803 |
+ /* |
|
804 |
+ * We've finished message we're parsing |
|
805 |
+ */ |
|
806 |
+ if(mainMessage && (mainMessage != messageIn)) { |
|
807 |
+ messageDestroy(mainMessage); |
|
808 |
+ mainMessage = NULL; |
|
807 | 809 |
} |
808 | 810 |
|
811 |
+ if(multiparts == 0) |
|
812 |
+ return 2; /* Nothing to do */ |
|
813 |
+ |
|
809 | 814 |
cli_dbgmsg("The message has %d parts\n", multiparts); |
810 | 815 |
cli_dbgmsg("Find out the multipart type(%s)\n", mimeSubtype); |
811 | 816 |
|
... | ... |
@@ -926,7 +934,6 @@ parseEmailBody(message *messageIn, blob **blobsIn, int nBlobs, text *textIn, con |
926 | 926 |
bool addAttachment = FALSE; |
927 | 927 |
bool addToText = FALSE; |
928 | 928 |
const char *dtype; |
929 |
- text *t; |
|
930 | 929 |
message *body; |
931 | 930 |
|
932 | 931 |
aMessage = messages[i]; |
... | ... |
@@ -1046,9 +1053,10 @@ parseEmailBody(message *messageIn, blob **blobsIn, int nBlobs, text *textIn, con |
1046 | 1046 |
if(mainMessage && (mainMessage != messageIn)) |
1047 | 1047 |
messageDestroy(mainMessage); |
1048 | 1048 |
|
1049 |
- t = messageToText(body); |
|
1050 |
- rc = parseEmailBody(body, blobs, nBlobs, t, dir, rfc821Table, subtypeTable); |
|
1051 |
- textDestroy(t); |
|
1049 |
+ /*t = messageToText(body); |
|
1050 |
+ rc = parseEmailBody(body, blobs, nBlobs, t, dir, rfc821Table, subtypeTable);*/ |
|
1051 |
+ rc = parseEmailBody(body, blobs, nBlobs, aText, dir, rfc821Table, subtypeTable); |
|
1052 |
+ /*textDestroy(t);*/ |
|
1052 | 1053 |
|
1053 | 1054 |
cli_dbgmsg("Finished recursion\n"); |
1054 | 1055 |
|
... | ... |
@@ -1085,12 +1093,9 @@ parseEmailBody(message *messageIn, blob **blobsIn, int nBlobs, text *textIn, con |
1085 | 1085 |
assert(addToText || addAttachment); |
1086 | 1086 |
assert(!(addToText && addAttachment)); |
1087 | 1087 |
|
1088 |
- if(addToText) { |
|
1088 |
+ if(addToText) |
|
1089 | 1089 |
aText = textAdd(aText, messageGetBody(aMessage)); |
1090 |
- assert(aMessage == messages[i]); |
|
1091 |
- messageDestroy(messages[i]); |
|
1092 |
- messages[i] = NULL; |
|
1093 |
- } else if(addAttachment) { |
|
1090 |
+ else if(addAttachment) { |
|
1094 | 1091 |
blob *aBlob = messageToBlob(aMessage); |
1095 | 1092 |
|
1096 | 1093 |
if(aBlob) { |
... | ... |
@@ -1099,6 +1104,9 @@ parseEmailBody(message *messageIn, blob **blobsIn, int nBlobs, text *textIn, con |
1099 | 1099 |
blobList[numberOfAttachments++] = aBlob; |
1100 | 1100 |
} |
1101 | 1101 |
} |
1102 |
+ assert(aMessage == messages[i]); |
|
1103 |
+ messageDestroy(messages[i]); |
|
1104 |
+ messages[i] = NULL; |
|
1102 | 1105 |
} |
1103 | 1106 |
|
1104 | 1107 |
if(numberOfAttachments == 0) { |
... | ... |
@@ -17,6 +17,9 @@ |
17 | 17 |
* |
18 | 18 |
* Change History: |
19 | 19 |
* $Log: message.c,v $ |
20 |
+ * Revision 1.50 2004/03/31 17:00:20 nigelhorne |
|
21 |
+ * Code tidy up free memory earlier |
|
22 |
+ * |
|
20 | 23 |
* Revision 1.49 2004/03/29 09:22:03 nigelhorne |
21 | 24 |
* Tidy up code and reduce shuffling of data |
22 | 25 |
* |
... | ... |
@@ -144,7 +147,7 @@ |
144 | 144 |
* uuencodebegin() no longer static |
145 | 145 |
* |
146 | 146 |
*/ |
147 |
-static char const rcsid[] = "$Id: message.c,v 1.49 2004/03/29 09:22:03 nigelhorne Exp $"; |
|
147 |
+static char const rcsid[] = "$Id: message.c,v 1.50 2004/03/31 17:00:20 nigelhorne Exp $"; |
|
148 | 148 |
|
149 | 149 |
#if HAVE_CONFIG_H |
150 | 150 |
#include "clamav-config.h" |
... | ... |
@@ -713,7 +716,8 @@ messageAddLine(message *m, const char *line, int takeCopy) |
713 | 713 |
*/ |
714 | 714 |
if(line) { |
715 | 715 |
if((m->encoding == NULL) && |
716 |
- (strncasecmp(line, encoding, sizeof(encoding) - 1) == 0)) |
|
716 |
+ (strncasecmp(line, encoding, sizeof(encoding) - 1) == 0) && |
|
717 |
+ (strstr(line, "7bit") == NULL)) |
|
717 | 718 |
m->encoding = m->body_last; |
718 | 719 |
else if((m->bounce == NULL) && |
719 | 720 |
(cli_filetype(line, strlen(line)) == CL_MAILFILE)) |