fix buf free and some extras...

SVN revision: 19824
This commit is contained in:
Carsten Haitzler 2006-01-15 10:04:39 +00:00
parent 1ba4131a15
commit d983846eb3
1 changed files with 12 additions and 8 deletions

View File

@ -212,12 +212,10 @@ evas_module_load(Evas_Module *em)
if (em->loaded) return 1; if (em->loaded) return 1;
snprintf(buf, sizeof(buf), "%s/%s/%s/module.so", snprintf(buf, sizeof(buf), "%s/%s/%s/module.so", em->path, em->name, MODULE_ARCH);
em->path, em->name, MODULE_ARCH);
if (!evas_file_path_exists(buf)) if (!evas_file_path_exists(buf))
{ {
printf("[evas module] error loading the module %s. It doesnt exists\n", buf); printf("[evas module] error loading the module %s. It doesnt exists\n", buf);
free(buf);
return 0; return 0;
} }
@ -235,9 +233,8 @@ evas_module_load(Evas_Module *em)
if (em->api->version != EVAS_MODULE_API_VERSION) if (em->api->version != EVAS_MODULE_API_VERSION)
{ {
printf("[evas module] error loading the modules %s. The version doesnt match\n", buf); printf("[evas module] error loading the modules %s. The version doesnt match\n", buf);
free(buf); goto error_dl;
} }
em->func.open(em); em->func.open(em);
em->loaded = 1; em->loaded = 1;
return 1; return 1;
@ -245,13 +242,16 @@ evas_module_load(Evas_Module *em)
error_dl: error_dl:
{ {
char *err; char *err;
err = dlerror(); err = dlerror();
printf("[evas module] error loading the module %s. %s\n", buf, err); printf("[evas module] error loading the module %s. %s\n", buf, err);
dlclose(handle); dlclose(handle);
em->handle = NULL; em->handle = NULL;
free(buf); em->func.open = NULL;
return 0; em->func.close = NULL;
em->api = NULL;
} }
return 0;
} }
void void
@ -263,8 +263,12 @@ evas_module_unload(Evas_Module *em)
{ {
em->func.close(em); em->func.close(em);
dlclose(em->handle); dlclose(em->handle);
em->loaded = 0;
} }
em->handle = NULL;
em->func.open = NULL;
em->func.close = NULL;
em->api = NULL;
em->loaded = 0;
} }
/* will dlclose all the modules loaded and free all the structs */ /* will dlclose all the modules loaded and free all the structs */