summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgeniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2006-06-13 11:09:40 +0000
committergeniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2006-06-13 11:09:40 +0000
commitaaa81d2dfb32ac81455d1b4fdbba343bd685f554 (patch)
treec7c7749cbb4313cefac33757335e046c11d15fdf
parentd4674e1e67acaba9769d63c3ca2b95f7b5068288 (diff)
BUILD : 1.7.14 (1047) BUGS : 464 NOTES : Added cleanup code to tools/anopesmtp to clear out used memory etc...
git-svn-id: svn://svn.anope.org/anope/trunk@1047 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@771 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r--Changes1
-rw-r--r--src/tools/anopesmtp.c33
-rw-r--r--version.log6
3 files changed, 39 insertions, 1 deletions
diff --git a/Changes b/Changes
index e73c413f8..6aa3c5afe 100644
--- a/Changes
+++ b/Changes
@@ -19,6 +19,7 @@ Provided by Anope Dev. <dev@anope.org> - 2006
06/11 F Updated InspIRCd protocol support module. [ #00]
06/11 F Module Clear Error macro was broken on *BSD. [#515]
06/13 F Walking memory using wrong pointer in moduleGetConfigDirective. [#516]
+06/13 F Added cleanup code to tools/anopesmtp. [#464]
Provided by ThaPrince <jon@vile.com> - 2006
05/19 A Plexus 3 support. [ #00]
diff --git a/src/tools/anopesmtp.c b/src/tools/anopesmtp.c
index 910caa3bc..59231b4ef 100644
--- a/src/tools/anopesmtp.c
+++ b/src/tools/anopesmtp.c
@@ -492,6 +492,35 @@ void smtp_disconnect()
/*************************************************************************/
+void mail_cleanup()
+{
+ struct smtp_header *headers, *nexth;
+ struct smtp_body_line *body, *nextb;
+
+ if (mail.from)
+ free(mail.from);
+ if (mail.to)
+ free(mail.to);
+
+ headers = mail.smtp_headers;
+ while (headers) {
+ nexth = headers->next;
+ free(headers->header);
+ free(headers);
+ headers = nexth;
+ }
+
+ body = mail.smtp_body;
+ while (body) {
+ nextb = body->next;
+ free(body->line);
+ free(body);
+ body = nextb;
+ }
+}
+
+/*************************************************************************/
+
int main(int argc, char *argv[])
{
char buf[8192];
@@ -556,12 +585,16 @@ int main(int argc, char *argv[])
if (!smtp_connect(server, port)) {
alog("SMTP: failed to connect to %s:%d",server, port);
+ mail_cleanup();
return 0;
}
if (!smtp_send_email()) {
alog("SMTP: error during sending of mail");
+ mail_cleanup();
return 0;
}
smtp_disconnect();
+ mail_cleanup();
+
return 1;
}
diff --git a/version.log b/version.log
index 0308b250b..763764366 100644
--- a/version.log
+++ b/version.log
@@ -9,10 +9,14 @@ VERSION_MAJOR="1"
VERSION_MINOR="7"
VERSION_PATCH="14"
VERSION_EXTRA=""
-VERSION_BUILD="1046"
+VERSION_BUILD="1047"
# $Log$
#
+# BUILD : 1.7.14 (1047)
+# BUGS : 464
+# NOTES : Added cleanup code to tools/anopesmtp to clear out used memory etc...
+#
# BUILD : 1.7.14 (1046)
# BUGS :
# NOTES : We were walking memory in moduleGetConfigDirecte with an allocated pointer, and free-ing it later when it was past the allocatrd space... We now store the original pointer so we can free it correctly :)