mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-23 17:38:54 +02:00
Fix a memleak
An early exit in expand_application_parameters forgot to free a GString. Reported by Steve Grubb.
This commit is contained in:
@@ -716,16 +716,18 @@ expand_application_parameters (GDesktopAppInfo *info,
|
|||||||
{
|
{
|
||||||
GList *uri_list = *uris;
|
GList *uri_list = *uris;
|
||||||
const char *p = info->exec;
|
const char *p = info->exec;
|
||||||
GString *expanded_exec = g_string_new (NULL);
|
GString *expanded_exec;
|
||||||
gboolean res;
|
gboolean res;
|
||||||
|
|
||||||
if (info->exec == NULL)
|
if (info->exec == NULL)
|
||||||
{
|
{
|
||||||
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||||
_("Desktop file didn't specify Exec field"));
|
_("Desktop file didn't specify Exec field"));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
expanded_exec = g_string_new (NULL);
|
||||||
|
|
||||||
while (*p)
|
while (*p)
|
||||||
{
|
{
|
||||||
if (p[0] == '%' && p[1] != '\0')
|
if (p[0] == '%' && p[1] != '\0')
|
||||||
@@ -735,10 +737,10 @@ expand_application_parameters (GDesktopAppInfo *info,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
g_string_append_c (expanded_exec, *p);
|
g_string_append_c (expanded_exec, *p);
|
||||||
|
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No file substitutions */
|
/* No file substitutions */
|
||||||
if (uri_list == *uris && uri_list != NULL)
|
if (uri_list == *uris && uri_list != NULL)
|
||||||
{
|
{
|
||||||
@@ -746,7 +748,7 @@ expand_application_parameters (GDesktopAppInfo *info,
|
|||||||
g_string_append_c (expanded_exec, ' ');
|
g_string_append_c (expanded_exec, ' ');
|
||||||
expand_macro ('f', expanded_exec, info, uris);
|
expand_macro ('f', expanded_exec, info, uris);
|
||||||
}
|
}
|
||||||
|
|
||||||
res = g_shell_parse_argv (expanded_exec->str, argc, argv, error);
|
res = g_shell_parse_argv (expanded_exec->str, argc, argv, error);
|
||||||
g_string_free (expanded_exec, TRUE);
|
g_string_free (expanded_exec, TRUE);
|
||||||
return res;
|
return res;
|
||||||
|
Reference in New Issue
Block a user