codebrainz commented on this pull request.
> @@ -205,6 +205,26 @@ static gchar *generate_find_string(GeanyProject *prj)
}
+static const gchar *get_base_path(void)
+{
+ static gchar *ret = NULL;
You could always just return a non-static allocated pointer and free it where
used like most other C functions. All it costs is not embedding function calls
directly into argument list of other function calls, which is itself a
minefield with C's undefined order of argument evaluation.
More importantly though, using `static` in `dlopen`'d modules is particularly a
bad idea, not only because of the real leak upon unloading/reloading the
plugin, but also because static variables may not be properly reinitialized on
subsequent re-loading of the plugin (depends on `RTLD_NODELETE` and likely
other flags), so this could result in some kinds of weird double-frees or
similar memory corruption, in theory. It's just asking for trouble, IMO.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/pull/755#discussion_r195600055