gplugin/gplugin

a53b048e32ae
Parents 7149b8887b13
Children d028ac082bea
fix possible leaking loader for early returns too
--- a/gplugin/gplugin-manager.c Thu Aug 19 16:27:00 2021 -0500
+++ b/gplugin/gplugin-manager.c Thu Aug 19 16:27:00 2021 -0500
@@ -1629,7 +1629,8 @@
gplugin_plugin_set_state(plugin, GPLUGIN_PLUGIN_STATE_LOAD_FAILED);
- return FALSE;
+ ret = FALSE;
+ goto cleanup;
}
g_signal_emit(manager, signals[SIG_LOADING], 0, plugin, &real_error, &ret);
@@ -1641,7 +1642,7 @@
gplugin_plugin_set_state(plugin, GPLUGIN_PLUGIN_STATE_LOAD_FAILED);
- return ret;
+ goto cleanup;
}
ret = gplugin_loader_load_plugin(loader, plugin, &real_error);
@@ -1654,6 +1655,7 @@
g_propagate_error(error, real_error);
}
+ cleanup:
g_object_unref(G_OBJECT(loader));
return ret;
@@ -1695,7 +1697,8 @@
0,
_("Plugin loader is not a loader"));
- return FALSE;
+ ret = FALSE;
+ goto cleanup;
}
g_signal_emit(
@@ -1713,7 +1716,7 @@
gplugin_plugin_set_state(plugin, GPLUGIN_PLUGIN_STATE_LOAD_FAILED);
- return ret;
+ goto cleanup;
}
ret = gplugin_loader_unload_plugin(loader, plugin, &real_error);
@@ -1726,6 +1729,7 @@
g_propagate_error(error, real_error);
}
+ cleanup:
g_object_unref(G_OBJECT(loader));
return ret;