Enlightenment CVS committal

Author  : tsauerbeck
Project : misc
Module  : embrace

Dir     : misc/embrace/src/plugins/pop3


Modified Files:
        pop3.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/pop3/pop3.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- pop3.c      17 Apr 2004 10:16:40 -0000      1.6
+++ pop3.c      17 Apr 2004 15:05:51 -0000      1.7
@@ -1,5 +1,5 @@
 /*
- * $Id: pop3.c,v 1.6 2004/04/17 10:16:40 tsauerbeck Exp $
+ * $Id: pop3.c,v 1.7 2004/04/17 15:05:51 tsauerbeck Exp $
  *
  * Copyright (C) 2004 Embrace project.
  *
@@ -70,7 +70,7 @@
 
        /* take the data and make a NUL-terminated string out of it */
        len = sizeof (inbuf) - 1;
-       len = MIN(len, ev->size);
+       len = MIN (len, ev->size);
 
        memcpy (inbuf, ev->data, len);
        inbuf[len] = 0;
@@ -240,10 +240,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, "[pop3] 'host' not specified!\n");
                return false;
+       }
 
        mailbox_property_set (mb, "host", str);
+       free (str);
 
        /* read port */
        snprintf (key, sizeof (key), "%s/port", root);
@@ -256,14 +259,24 @@
        /* 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, "[pop3] '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, "[pop3] 'pass' not specified!\n");
+               return false;
+       }
+       
+       mailbox_property_set (mb, "pass", 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