Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/ecore

Dir     : e17/libs/ecore/src/lib/ecore_config


Modified Files:
        ecore_config.c 


Log Message:
Fix a memory leak if the local bundle is NULL.
Use a generic FAIL error when the local bundle is NULL.
Return a more detailed error report from the type add function.

===================================================================
RCS file: 
/cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_config/ecore_config.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -3 -r1.59 -r1.60
--- ecore_config.c      2 Mar 2005 07:06:34 -0000       1.59
+++ ecore_config.c      20 Jul 2005 14:21:40 -0000      1.60
@@ -549,6 +549,7 @@
 static int
 ecore_config_typed_add(const char *key, const void *val, int type)
 {
+   int error = ECORE_CONFIG_ERR_SUCC;
    Ecore_Config_Prop  *e;
    Ecore_Config_Bundle *t;
 
@@ -561,23 +562,29 @@
    memset(e, 0, sizeof(Ecore_Config_Prop));
 
    if (!(e->key = strdup(key)))
-      goto ret_free_nte;
+     {
+       error = ECORE_CONFIG_ERR_OOM;
+        goto ret_free_nte;
+     }
 
-   if (ecore_config_typed_val(e, val, type) == ECORE_CONFIG_ERR_OOM)
+   if ((error = ecore_config_typed_val(e, val, type) != ECORE_CONFIG_ERR_SUCC))
       goto ret_free_key;
 
    e->next = t ? t->data : NULL;
    if (t)
-      t->data = e;
-
-   return ECORE_CONFIG_ERR_SUCC;
+     {
+       t->data = e;
+       return ECORE_CONFIG_ERR_SUCC;
+     }
 
  ret_free_key:
    free(e->key);
  ret_free_nte:
    free(e);
  ret:
-   return ECORE_CONFIG_ERR_OOM;
+   if (error == ECORE_CONFIG_ERR_SUCC)
+      error = ECORE_CONFIG_ERR_FAIL;
+   return error;
 }
 
 static int




-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to