Enlightenment CVS committal

Author  : tsauerbeck
Project : misc
Module  : embrace

Dir     : misc/embrace/src/plugins/imap


Modified Files:
        imap.c 


Log Message:
fixed memleaks caused by not freeing the result of e_db_str_get(). finally embrace 
will tell you when a mailbox cannot be loaded due to configuration errors.
===================================================================
RCS file: /cvsroot/enlightenment/misc/embrace/src/plugins/imap/imap.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- imap.c      17 Apr 2004 10:16:40 -0000      1.6
+++ imap.c      17 Apr 2004 15:05:51 -0000      1.7
@@ -1,5 +1,5 @@
 /*
- * $Id: imap.c,v 1.6 2004/04/17 10:16:40 tsauerbeck Exp $
+ * $Id: imap.c,v 1.7 2004/04/17 15:05:51 tsauerbeck Exp $
  * vim:noexpandtab:ts=4:sw=4:sts=4
  *
  * Copyright (C) 2004 Embrace project.
@@ -184,10 +184,13 @@
        /* read server */
        snprintf (key, sizeof (key), "%s/host", root);
 
-       if (!(str = e_db_str_get (edb, key)))
+       if (!(str = e_db_str_get (edb, key))) {
+               fprintf (stderr, "[imap] 'host' not specified!\n");
                return false;
+       }
 
        mailbox_property_set (mb, "host", str);
+       free (str);
 
        /* read port */
        snprintf (key, sizeof (key), "%s/port", root);
@@ -200,20 +203,35 @@
        /* read username */
        snprintf (key, sizeof (key), "%s/user", root);
 
-       if ((str = e_db_str_get (edb, key)))
-               mailbox_property_set (mb, "user", str);
+       if (!(str = e_db_str_get (edb, key))) {
+               fprintf (stderr, "[imap] 'user' not specified!\n");
+               return false;
+       }
+       
+       mailbox_property_set (mb, "user", str);
+       free (str),
 
        /* read password */
        snprintf (key, sizeof (key), "%s/pass", root);
 
-       if ((str = e_db_str_get (edb, key)))
-               mailbox_property_set (mb, "pass", str);
+       if (!(str = e_db_str_get (edb, key))) {
+               fprintf (stderr, "[imap] 'user' not specified!\n");
+               return false;
+       }
+       
+       mailbox_property_set (mb, "pass", str);
+       free (str);
        
        /* read mailbox path */
        snprintf (key, sizeof (key), "%s/path", root);
        
-       if ((str = e_db_str_get (edb, key)))
-               mailbox_property_set (mb, "path", str);
+       if (!(str = e_db_str_get (edb, key))) {
+               fprintf (stderr, "[imap] 'path' not specified!\n");
+               return false;
+       }
+       
+       mailbox_property_set (mb, "path", str);
+       free (str),
 
        return true;
 }




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to