summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColomban Wendling <[email protected]>2020-08-05 12:09:16 +0200
committerRobert Antoni Buj Gelonch <[email protected]>2020-08-05 16:56:38 +0200
commitdb4696db69637e09434aa0f35af73cba439271dd (patch)
tree07a0342cdb7d8012081ff4dfd88a570de0729f60
parenta3811a55c5a55df4dbb7b56f50a4445f9e3bb33b (diff)
downloadmate-panel-db4696db69637e09434aa0f35af73cba439271dd.tar.bz2
mate-panel-db4696db69637e09434aa0f35af73cba439271dd.tar.xz
launcher: Fix memory leaks
-rw-r--r--mate-panel/launcher.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/mate-panel/launcher.c b/mate-panel/launcher.c
index 848d92ae..d7d36556 100644
--- a/mate-panel/launcher.c
+++ b/mate-panel/launcher.c
@@ -909,6 +909,7 @@ launcher_load_from_gsettings (PanelWidget *panel_widget,
if (!launcher_location) {
g_printerr (_("Key %s is not set, cannot load launcher\n"),
PANEL_OBJECT_LAUNCHER_LOCATION_KEY);
+ g_object_unref (settings);
return;
}
@@ -1044,6 +1045,7 @@ panel_launcher_create_from_info (PanelToplevel *toplevel,
g_error_free (error);
}
+ g_free (location);
g_key_file_free (key_file);
}
@@ -1106,11 +1108,10 @@ panel_launcher_create_copy (PanelToplevel *toplevel,
int position,
const char *location)
{
- char *new_location;
- GFile *source;
- GFile *dest;
- gboolean copied;
- const char *filename;
+ char *new_location;
+ GFile *source;
+ GFile *dest;
+ gboolean copied;
new_location = panel_make_unique_desktop_uri (NULL, location);
@@ -1120,16 +1121,19 @@ panel_launcher_create_copy (PanelToplevel *toplevel,
copied = g_file_copy (source, dest, G_FILE_COPY_OVERWRITE,
NULL, NULL, NULL, NULL);
- if (!copied) {
- g_free (new_location);
- return FALSE;
+ if (copied) {
+ gchar *filename;
+
+ filename = panel_launcher_get_filename (new_location);
+ panel_launcher_create (toplevel, position, filename);
+ g_free (filename);
}
- filename = panel_launcher_get_filename (new_location);
- panel_launcher_create (toplevel, position, filename);
+ g_object_unref (source);
+ g_object_unref (dest);
g_free (new_location);
- return TRUE;
+ return copied;
}
Launcher *