Commit 9aefcf62 authored by Sven Neumann's avatar Sven Neumann
Browse files

Reverted a tiny part of my latest change since the old code was OK while

my change did introduce a memleak. Oooops.
parent 3bf5c539
......@@ -301,9 +301,15 @@ script_fu_find_scripts (void)
while (token)
{
if (*token == '~')
path = g_strdup_printf ("%s%s", home, token + 1);
else
path = g_strdup (token);
{
path = g_malloc (strlen (home) + strlen (token) + 2);
sprintf (path, "%s%s", home, token + 1);
}
else
{
path = g_malloc (strlen (token) + 2);
strcpy (path, token);
}
/* Check if directory exists and if it has any items in it */
my_err = stat (path, &filestat);
......@@ -311,8 +317,8 @@ script_fu_find_scripts (void)
if (!my_err && S_ISDIR (filestat.st_mode))
{
if (path[strlen (path) - 1] != G_DIR_SEPARATOR)
path = g_strconcat (path, G_DIR_SEPARATOR_S, NULL);
strcat (path, G_DIR_SEPARATOR_S);
/* Open directory */
dir = opendir (path);
......@@ -775,6 +781,8 @@ script_fu_report_cc (gchar *command)
g_free (sf_interface->last_command);
sf_interface->last_command = g_strdup (command);
}
gdk_flush ();
}
......
......@@ -301,9 +301,15 @@ script_fu_find_scripts (void)
while (token)
{
if (*token == '~')
path = g_strdup_printf ("%s%s", home, token + 1);
else
path = g_strdup (token);
{
path = g_malloc (strlen (home) + strlen (token) + 2);
sprintf (path, "%s%s", home, token + 1);
}
else
{
path = g_malloc (strlen (token) + 2);
strcpy (path, token);
}
/* Check if directory exists and if it has any items in it */
my_err = stat (path, &filestat);
......@@ -311,8 +317,8 @@ script_fu_find_scripts (void)
if (!my_err && S_ISDIR (filestat.st_mode))
{
if (path[strlen (path) - 1] != G_DIR_SEPARATOR)
path = g_strconcat (path, G_DIR_SEPARATOR_S, NULL);
strcat (path, G_DIR_SEPARATOR_S);
/* Open directory */
dir = opendir (path);
......@@ -775,6 +781,8 @@ script_fu_report_cc (gchar *command)
g_free (sf_interface->last_command);
sf_interface->last_command = g_strdup (command);
}
gdk_flush ();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment