summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbdpngn <rbdpngn>2005-07-20 14:21:40 +0000
committerrbdpngn <rbdpngn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>2005-07-20 14:21:40 +0000
commit85f1d386d8f3e7d59f010ae17bb8ecc03d9d2b47 (patch)
treeb09f1b9a4b3aae401312442876699a24f4f6daff
parentfc1a4a2027f2c821a87ec3059fb0b91ce5ad5f4b (diff)
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. SVN revision: 15839
-rw-r--r--legacy/ecore/src/lib/ecore_config/ecore_config.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/legacy/ecore/src/lib/ecore_config/ecore_config.c b/legacy/ecore/src/lib/ecore_config/ecore_config.c
index 33b4bc73a3..df6ea43449 100644
--- a/legacy/ecore/src/lib/ecore_config/ecore_config.c
+++ b/legacy/ecore/src/lib/ecore_config/ecore_config.c
@@ -549,6 +549,7 @@ ecore_config_typed_val(Ecore_Config_Prop * e, const void *val, int type)
549static int 549static int
550ecore_config_typed_add(const char *key, const void *val, int type) 550ecore_config_typed_add(const char *key, const void *val, int type)
551{ 551{
552 int error = ECORE_CONFIG_ERR_SUCC;
552 Ecore_Config_Prop *e; 553 Ecore_Config_Prop *e;
553 Ecore_Config_Bundle *t; 554 Ecore_Config_Bundle *t;
554 555
@@ -561,23 +562,29 @@ ecore_config_typed_add(const char *key, const void *val, int type)
561 memset(e, 0, sizeof(Ecore_Config_Prop)); 562 memset(e, 0, sizeof(Ecore_Config_Prop));
562 563
563 if (!(e->key = strdup(key))) 564 if (!(e->key = strdup(key)))
564 goto ret_free_nte; 565 {
566 error = ECORE_CONFIG_ERR_OOM;
567 goto ret_free_nte;
568 }
565 569
566 if (ecore_config_typed_val(e, val, type) == ECORE_CONFIG_ERR_OOM) 570 if ((error = ecore_config_typed_val(e, val, type) != ECORE_CONFIG_ERR_SUCC))
567 goto ret_free_key; 571 goto ret_free_key;
568 572
569 e->next = t ? t->data : NULL; 573 e->next = t ? t->data : NULL;
570 if (t) 574 if (t)
571 t->data = e; 575 {
572 576 t->data = e;
573 return ECORE_CONFIG_ERR_SUCC; 577 return ECORE_CONFIG_ERR_SUCC;
578 }
574 579
575 ret_free_key: 580 ret_free_key:
576 free(e->key); 581 free(e->key);
577 ret_free_nte: 582 ret_free_nte:
578 free(e); 583 free(e);
579 ret: 584 ret:
580 return ECORE_CONFIG_ERR_OOM; 585 if (error == ECORE_CONFIG_ERR_SUCC)
586 error = ECORE_CONFIG_ERR_FAIL;
587 return error;
581} 588}
582 589
583static int 590static int