Skip to content

Commit

Permalink
[core] fix GError leak
Browse files Browse the repository at this point in the history
Change-Id: I581d34880a4a592a6f81c49c21e95c7fb0061db6
  • Loading branch information
stbuehler committed Feb 6, 2024
1 parent 2b4e6d3 commit 1735f55
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/common/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ liModule* li_module_load(liModules *mods, const gchar* name, GError **err) {
mod->module = g_module_open(mod->path, G_MODULE_BIND_LAZY);

if (!mod->module) {
/* remember original error if second try fails too */
if (err) g_set_error(err, LI_MODULES_ERROR, 1, "%s", g_module_error());
g_free(mod->path);

Expand All @@ -86,6 +87,12 @@ liModule* li_module_load(liModules *mods, const gchar* name, GError **err) {
g_slice_free(liModule, mod);
return NULL;
}

/* it worked out, clean error */
if (err) {
g_error_free(*err);
*err = NULL;
}
}

/* temporary strings for mod_xyz_init and mod_xyz_free */
Expand Down

0 comments on commit 1735f55

Please sign in to comment.