diff --git a/toolkit/system/gnome/nsGIOService.cpp b/toolkit/system/gnome/nsGIOService.cpp index 675ae397c1b3..94e2c9195308 100644 --- a/toolkit/system/gnome/nsGIOService.cpp +++ b/toolkit/system/gnome/nsGIOService.cpp @@ -135,22 +135,12 @@ nsGIOMimeApp::GetExpectsURIs(PRInt32* aExpects) NS_IMETHODIMP nsGIOMimeApp::Launch(const nsACString& aUri) { - char *uri = strdup(PromiseFlatCString(aUri).get()); + GList uris = { 0 }; + PromiseFlatCString flatUri(aUri); + uris.data = const_cast(flatUri.get()); - if (!uri) - return NS_ERROR_OUT_OF_MEMORY; - - GList *uris = g_list_append(NULL, uri); - - if (!uris) { - g_free(uri); - return NS_ERROR_OUT_OF_MEMORY; - } GError *error = NULL; - gboolean result = g_app_info_launch_uris(mApp, uris, NULL, &error); - - g_free(uri); - g_list_free(uris); + gboolean result = g_app_info_launch_uris(mApp, &uris, NULL, &error); if (!result) { g_warning("Cannot launch application: %s", error->message); diff --git a/toolkit/system/gnome/nsGnomeVFSService.cpp b/toolkit/system/gnome/nsGnomeVFSService.cpp index bcb7800e1706..dd964913b108 100644 --- a/toolkit/system/gnome/nsGnomeVFSService.cpp +++ b/toolkit/system/gnome/nsGnomeVFSService.cpp @@ -107,17 +107,11 @@ nsGnomeVFSMimeApp::Launch(const nsACString &aUri) if (! uri) return NS_ERROR_FAILURE; - GList *uris = g_list_append(NULL, uri); - - if (! uris) { - g_free(uri); - return NS_ERROR_FAILURE; - } - - GnomeVFSResult result = gnome_vfs_mime_application_launch(mApp, uris); + GList uris = { 0 }; + uris.data = uri; + GnomeVFSResult result = gnome_vfs_mime_application_launch(mApp, &uris); g_free(uri); - g_list_free(uris); if (result != GNOME_VFS_OK) return NS_ERROR_FAILURE;