summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgnacio Casal Quinteiro <qignacio@amazon.com>2018-01-05 16:46:58 +0100
committerIgnacio Casal Quinteiro <qignacio@amazon.com>2018-01-12 08:50:15 +0100
commit971b09fcd8f1ff5e1c4df0772feab2371bbcdced (patch)
treeefa65a70c89e51cde7bc50e5f4cf20cb30266c9f
parent0af848466792b23a1399f72e4a5efd1f41228cca (diff)
downloadgdk-pixbuf-971b09fcd8f1ff5e1c4df0772feab2371bbcdced.tar.gz
queryloaders: strdup moduledir
Needed for a follow up patch which will fix a memory leak on the windows code path
-rw-r--r--gdk-pixbuf/queryloaders.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/gdk-pixbuf/queryloaders.c b/gdk-pixbuf/queryloaders.c
index 0fb40fd36..085ef7c8c 100644
--- a/gdk-pixbuf/queryloaders.c
+++ b/gdk-pixbuf/queryloaders.c
@@ -338,17 +338,19 @@ int main (int argc, char **argv)
if (argc == first_file) {
#ifdef USE_GMODULE
- const char *moduledir;
+ char *moduledir;
GDir *dir;
GList *l, *modules;
- moduledir = g_getenv ("GDK_PIXBUF_MODULEDIR");
+ moduledir = g_strdup (g_getenv ("GDK_PIXBUF_MODULEDIR"));
#ifdef G_OS_WIN32
if (moduledir != NULL && *moduledir != '\0')
moduledir = g_locale_to_utf8 (moduledir, -1, NULL, NULL, NULL);
#endif
- if (moduledir == NULL || *moduledir == '\0')
- moduledir = PIXBUF_LIBDIR;
+ if (moduledir == NULL || *moduledir == '\0') {
+ g_free (moduledir);
+ moduledir = g_strdup (PIXBUF_LIBDIR);
+ }
g_string_append_printf (contents, "# LoaderDir = %s\n#\n", moduledir);
@@ -371,6 +373,7 @@ int main (int argc, char **argv)
for (l = modules; l != NULL; l = l->next)
query_module (contents, moduledir, l->data);
g_list_free_full (modules, g_free);
+ g_free (moduledir);
#else
g_string_append_printf (contents, "# dynamic loading of modules not supported\n");
#endif