forked from enlightenment/efl
* eina: Remove memory leak (patch from Andre Dieb).
SVN revision: 40986
This commit is contained in:
parent
fca7b4aa43
commit
35526933af
|
@ -530,7 +530,6 @@ EAPI int eina_error_init(void)
|
||||||
{
|
{
|
||||||
char *level;
|
char *level;
|
||||||
/* TODO register the eina's basic errors */
|
/* TODO register the eina's basic errors */
|
||||||
/* TODO load the environment variable for getting the log level */
|
|
||||||
if ((level = getenv("EINA_ERROR_LEVEL")))
|
if ((level = getenv("EINA_ERROR_LEVEL")))
|
||||||
{
|
{
|
||||||
_error_level = atoi(level);
|
_error_level = atoi(level);
|
||||||
|
|
|
@ -123,8 +123,16 @@ eina_mempool_init(void)
|
||||||
{
|
{
|
||||||
char *path;
|
char *path;
|
||||||
|
|
||||||
eina_hash_init();
|
if (!eina_hash_init())
|
||||||
eina_module_init();
|
{
|
||||||
|
fprintf(stderr, "Could not initialize eina hash module.\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (!eina_module_init())
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Could not initialize eina module module.\n");
|
||||||
|
goto module_init_error;
|
||||||
|
}
|
||||||
|
|
||||||
EINA_ERROR_NOT_MEMPOOL_MODULE = eina_error_msg_register("Not a memory pool module.");
|
EINA_ERROR_NOT_MEMPOOL_MODULE = eina_error_msg_register("Not a memory pool module.");
|
||||||
_backends = eina_hash_string_superfast_new(NULL);
|
_backends = eina_hash_string_superfast_new(NULL);
|
||||||
|
@ -147,7 +155,8 @@ eina_mempool_init(void)
|
||||||
if (!_modules)
|
if (!_modules)
|
||||||
{
|
{
|
||||||
EINA_ERROR_PERR("ERROR: no mempool modules able to be loaded.\n");
|
EINA_ERROR_PERR("ERROR: no mempool modules able to be loaded.\n");
|
||||||
abort();
|
eina_hash_free(_backends);
|
||||||
|
goto mempool_init_error;
|
||||||
}
|
}
|
||||||
eina_module_list_load(_modules);
|
eina_module_list_load(_modules);
|
||||||
/* builtin backends */
|
/* builtin backends */
|
||||||
|
@ -165,6 +174,14 @@ eina_mempool_init(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return ++_init_count;
|
return ++_init_count;
|
||||||
|
|
||||||
|
mempool_init_error:
|
||||||
|
eina_module_shutdown();
|
||||||
|
module_init_error:
|
||||||
|
eina_hash_shutdown();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -190,9 +207,15 @@ eina_mempool_shutdown(void)
|
||||||
ememoa_fixed_shutdown();
|
ememoa_fixed_shutdown();
|
||||||
#endif
|
#endif
|
||||||
/* dynamic backends */
|
/* dynamic backends */
|
||||||
eina_module_list_unload(_modules);
|
eina_module_list_delete(_modules);
|
||||||
|
if (_modules)
|
||||||
|
eina_array_free(_modules);
|
||||||
|
|
||||||
eina_module_shutdown();
|
eina_module_shutdown();
|
||||||
/* TODO delete the _modules list */
|
|
||||||
|
if (_backends)
|
||||||
|
eina_hash_free(_backends);
|
||||||
|
|
||||||
eina_hash_shutdown();
|
eina_hash_shutdown();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue