Re: [Dbmail-dev] explicit initalize of the config variable and 1 minor memleak for branch 2_2 rev 2480

2007-03-25 Thread Paul J Stevens

patch applied.

Leif Jackson wrote:
 Aaron it seem the path I sent with the config initializers got taken
 back out other than the change to dsn.c that is all this patch is.
 Otherwise the 2_2 branch is looking good as far as memleaks :)
 
 I was looking at the dbmail-message.c code and saw a new function
 convert_8bit_field_to_utf8 is used that looks like the function I
 patched for the iconv default leak... misc.c anyway I was wondering does
 the the new utf8 version also need the check for if default_iconv was
 allocated rather than just the g_mime_iconv_close if subj==NULL? just my
 ..02 but I think it is more explicit for all the possible cases. I would
 assube that the base_charset is always null and so default_iconv will
 always be allocated but then there are if statments that return before
 closing default_iconv that was my idea behind the
 if(allocated_default_iconv) looking at the code now tho it seems like it
 should always try and close it? What do you guys think?
 
 Side note to this if the dbmail code is calling this function a lot
 would it make sense to open the default_iconv once for each session at
 the least?
 
 
 Thanks,
 Leif
 
 diff -urN dbmail-svn-2.2.4-2480.orig/dsn.c dbmail-svn-2.2.4-2480.leif/dsn.c
 --- dbmail-svn-2.2.4-2480.orig/dsn.c2007-03-24 18:40:07.0 -0400
 +++ dbmail-svn-2.2.4-2480.leif/dsn.c2007-03-24 19:35:06.0 -0400
 @@ -234,6 +234,8 @@
g_free(dsnuser-forwards);
 
dsnuser-address = NULL;
 +   if (dsnuser-mailbox)
 +   g_free(dsnuser-mailbox); //allocated by dbmail-smtp
 main.c line ~ 319 g_strdup
dsnuser-mailbox = NULL;
dsnuser-userids = NULL;
dsnuser-forwards = NULL;
 diff -urN dbmail-svn-2.2.4-2480.orig/imapd.c
 dbmail-svn-2.2.4-2480.leif/imapd.c
 --- dbmail-svn-2.2.4-2480.orig/imapd.c  2007-03-24 18:40:07.0 -0400
 +++ dbmail-svn-2.2.4-2480.leif/imapd.c  2007-03-24 19:21:15.0 -0400
 @@ -40,6 +40,9 @@
g_mime_init(0);
openlog(PNAME, LOG_PID, LOG_MAIL);
 
 +   //fixes valgrind Conditional jump or move depends on
 uninitialised value(s)
 +   memset(config, 0, sizeof(serverConfig_t));
 +
result = serverparent_getopt(config, IMAP, argc, argv);
if (result == -1)
goto shutdown;
 diff -urN dbmail-svn-2.2.4-2480.orig/lmtpd.c
 dbmail-svn-2.2.4-2480.leif/lmtpd.c
 --- dbmail-svn-2.2.4-2480.orig/lmtpd.c  2007-03-24 18:40:07.0 -0400
 +++ dbmail-svn-2.2.4-2480.leif/lmtpd.c  2007-03-24 19:22:07.0 -0400
 @@ -40,6 +40,9 @@
g_mime_init(0);
openlog(PNAME, LOG_PID, LOG_MAIL);
 
 +//fixes valgrind Conditional jump or move depends on
 uninitialised value(s)
 +memset(config, 0, sizeof(serverConfig_t));
 +
result = serverparent_getopt(config, LMTP, argc, argv);
if (result == -1)
goto shutdown;
 diff -urN dbmail-svn-2.2.4-2480.orig/pop3d.c
 dbmail-svn-2.2.4-2480.leif/pop3d.c
 --- dbmail-svn-2.2.4-2480.orig/pop3d.c  2007-03-24 18:40:07.0 -0400
 +++ dbmail-svn-2.2.4-2480.leif/pop3d.c  2007-03-24 19:21:25.0 -0400
 @@ -44,6 +44,9 @@
g_mime_init(0);
openlog(PNAME, LOG_PID, LOG_MAIL);
 
 +//fixes valgrind Conditional jump or move depends on
 uninitialised value(s)
 +memset(config, 0, sizeof(serverConfig_t));
 +
result = serverparent_getopt(config, POP, argc, argv);
if (result == -1)
goto shutdown;
 diff -urN dbmail-svn-2.2.4-2480.orig/timsieved.c
 dbmail-svn-2.2.4-2480.leif/timsieved.c
 --- dbmail-svn-2.2.4-2480.orig/timsieved.c  2007-03-24
 18:40:07.0 -0400
 +++ dbmail-svn-2.2.4-2480.leif/timsieved.c  2007-03-24
 19:21:35.0 -0400
 @@ -42,6 +42,9 @@
g_mime_init(0);
openlog(PNAME, LOG_PID, LOG_MAIL);
 
 +//fixes valgrind Conditional jump or move depends on
 uninitialised value(s)
 +memset(config, 0, sizeof(serverConfig_t));
 +
result = serverparent_getopt(config, SIEVE, argc, argv);
if (result == -1)
goto shutdown;
 
 ___
 Dbmail-dev mailing list
 Dbmail-dev@dbmail.org
 http://twister.fastxs.net/mailman/listinfo/dbmail-dev
 


-- 
  
  Paul Stevens  paul at nfg.nl
  NET FACILITIES GROUP GPG/PGP: 1024D/11F8CD31
  The Netherlandshttp://www.nfg.nl
___
Dbmail-dev mailing list
Dbmail-dev@dbmail.org
http://twister.fastxs.net/mailman/listinfo/dbmail-dev


[Dbmail-dev] explicit initalize of the config variable and 1 minor memleak for branch 2_2 rev 2480

2007-03-24 Thread Leif Jackson
Aaron it seem the path I sent with the config initializers got taken 
back out other than the change to dsn.c that is all this patch is. 
Otherwise the 2_2 branch is looking good as far as memleaks :)


I was looking at the dbmail-message.c code and saw a new function 
convert_8bit_field_to_utf8 is used that looks like the function I 
patched for the iconv default leak... misc.c anyway I was wondering does 
the the new utf8 version also need the check for if default_iconv was 
allocated rather than just the g_mime_iconv_close if subj==NULL? just my 
.02 but I think it is more explicit for all the possible cases. I would 
assube that the base_charset is always null and so default_iconv will 
always be allocated but then there are if statments that return before 
closing default_iconv that was my idea behind the 
if(allocated_default_iconv) looking at the code now tho it seems like it 
should always try and close it? What do you guys think?


Side note to this if the dbmail code is calling this function a lot 
would it make sense to open the default_iconv once for each session at 
the least?



Thanks,
Leif

diff -urN dbmail-svn-2.2.4-2480.orig/dsn.c dbmail-svn-2.2.4-2480.leif/dsn.c
--- dbmail-svn-2.2.4-2480.orig/dsn.c2007-03-24 18:40:07.0 -0400
+++ dbmail-svn-2.2.4-2480.leif/dsn.c2007-03-24 19:35:06.0 -0400
@@ -234,6 +234,8 @@
   g_free(dsnuser-forwards);

   dsnuser-address = NULL;
+   if (dsnuser-mailbox)
+   g_free(dsnuser-mailbox); //allocated by dbmail-smtp 
main.c line ~ 319 g_strdup

   dsnuser-mailbox = NULL;
   dsnuser-userids = NULL;
   dsnuser-forwards = NULL;
diff -urN dbmail-svn-2.2.4-2480.orig/imapd.c 
dbmail-svn-2.2.4-2480.leif/imapd.c

--- dbmail-svn-2.2.4-2480.orig/imapd.c  2007-03-24 18:40:07.0 -0400
+++ dbmail-svn-2.2.4-2480.leif/imapd.c  2007-03-24 19:21:15.0 -0400
@@ -40,6 +40,9 @@
   g_mime_init(0);
   openlog(PNAME, LOG_PID, LOG_MAIL);

+   //fixes valgrind Conditional jump or move depends on 
uninitialised value(s)

+   memset(config, 0, sizeof(serverConfig_t));
+
   result = serverparent_getopt(config, IMAP, argc, argv);
   if (result == -1)
   goto shutdown;
diff -urN dbmail-svn-2.2.4-2480.orig/lmtpd.c 
dbmail-svn-2.2.4-2480.leif/lmtpd.c

--- dbmail-svn-2.2.4-2480.orig/lmtpd.c  2007-03-24 18:40:07.0 -0400
+++ dbmail-svn-2.2.4-2480.leif/lmtpd.c  2007-03-24 19:22:07.0 -0400
@@ -40,6 +40,9 @@
   g_mime_init(0);
   openlog(PNAME, LOG_PID, LOG_MAIL);

+//fixes valgrind Conditional jump or move depends on 
uninitialised value(s)

+memset(config, 0, sizeof(serverConfig_t));
+
   result = serverparent_getopt(config, LMTP, argc, argv);
   if (result == -1)
   goto shutdown;
diff -urN dbmail-svn-2.2.4-2480.orig/pop3d.c 
dbmail-svn-2.2.4-2480.leif/pop3d.c

--- dbmail-svn-2.2.4-2480.orig/pop3d.c  2007-03-24 18:40:07.0 -0400
+++ dbmail-svn-2.2.4-2480.leif/pop3d.c  2007-03-24 19:21:25.0 -0400
@@ -44,6 +44,9 @@
   g_mime_init(0);
   openlog(PNAME, LOG_PID, LOG_MAIL);

+//fixes valgrind Conditional jump or move depends on 
uninitialised value(s)

+memset(config, 0, sizeof(serverConfig_t));
+
   result = serverparent_getopt(config, POP, argc, argv);
   if (result == -1)
   goto shutdown;
diff -urN dbmail-svn-2.2.4-2480.orig/timsieved.c 
dbmail-svn-2.2.4-2480.leif/timsieved.c
--- dbmail-svn-2.2.4-2480.orig/timsieved.c  2007-03-24 
18:40:07.0 -0400
+++ dbmail-svn-2.2.4-2480.leif/timsieved.c  2007-03-24 
19:21:35.0 -0400

@@ -42,6 +42,9 @@
   g_mime_init(0);
   openlog(PNAME, LOG_PID, LOG_MAIL);

+//fixes valgrind Conditional jump or move depends on 
uninitialised value(s)

+memset(config, 0, sizeof(serverConfig_t));
+
   result = serverparent_getopt(config, SIEVE, argc, argv);
   if (result == -1)
   goto shutdown;

___
Dbmail-dev mailing list
Dbmail-dev@dbmail.org
http://twister.fastxs.net/mailman/listinfo/dbmail-dev