Plug a memory leak

svn path=/trunk/; revision=7520
This commit is contained in:
Matthias Clasen 2008-09-21 00:00:18 +00:00
parent 991b625aea
commit 130d8f010f
2 changed files with 15 additions and 3 deletions

View File

@ -1,3 +1,7 @@
2008-09-20 Matthias Clasen <mclasen@redhat.com>
* gdesktopappinfo.c (expand_macro_single): Plug a memory leak
2008-09-17 Matthias Clasen <mclasen@redhat.com> 2008-09-17 Matthias Clasen <mclasen@redhat.com>
* === Released 2.18.1 === * === Released 2.18.1 ===

View File

@ -480,7 +480,7 @@ expand_macro_single (char macro, char *uri)
{ {
GFile *file; GFile *file;
char *result = NULL; char *result = NULL;
char *path; char *path, *name;
file = g_file_new_for_uri (uri); file = g_file_new_for_uri (uri);
path = g_file_get_path (file); path = g_file_get_path (file);
@ -500,12 +500,20 @@ expand_macro_single (char macro, char *uri)
case 'd': case 'd':
case 'D': case 'D':
if (path) if (path)
result = g_shell_quote (g_path_get_dirname (path)); {
name = g_path_get_dirname (path);
result = g_shell_quote (name);
g_free (name);
}
break; break;
case 'n': case 'n':
case 'N': case 'N':
if (path) if (path)
result = g_shell_quote (g_path_get_basename (path)); {
name = g_path_get_basename (path);
result = g_shell_quote (name);
g_free (name);
}
break; break;
} }