[glib] gio-tool: Fix memory leaks on error paths in mount command
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gio-tool: Fix memory leaks on error paths in mount command
- Date: Mon, 11 Jul 2016 21:04:50 +0000 (UTC)
commit a9172c6d03de138fb91456b86adec23bf9421467
Author: Philip Withnall <philip tecnocode co uk>
Date: Mon Jul 11 21:56:04 2016 +0100
gio-tool: Fix memory leaks on error paths in mount command
Various GErrors were being leaked.
Coverity CID: 1357351 (amongst others)
gio/gio-tool-mount.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/gio/gio-tool-mount.c b/gio/gio-tool-mount.c
index 9f5b217..92d16c1 100644
--- a/gio/gio-tool-mount.c
+++ b/gio/gio-tool-mount.c
@@ -246,6 +246,8 @@ mount_mountable_done_cb (GObject *object,
g_printerr (_("Error mounting location: Anonymous access denied\n"));
else if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_FAILED_HANDLED))
g_printerr (_("Error mounting location: %s\n"), error->message);
+
+ g_error_free (error);
}
else
g_object_unref (target);
@@ -274,6 +276,8 @@ mount_done_cb (GObject *object,
g_printerr (_("Error mounting location: Anonymous access denied\n"));
else if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_FAILED_HANDLED))
g_printerr (_("Error mounting location: %s\n"), error->message);
+
+ g_error_free (error);
}
outstanding_mounts--;
@@ -336,6 +340,7 @@ unmount_done_cb (GObject *object,
{
g_printerr (_("Error unmounting mount: %s\n"), error->message);
success = FALSE;
+ g_error_free (error);
}
outstanding_mounts--;
@@ -360,6 +365,7 @@ unmount (GFile *file)
{
g_printerr (_("Error finding enclosing mount: %s\n"), error->message);
success = FALSE;
+ g_error_free (error);
return;
}
@@ -387,6 +393,7 @@ eject_done_cb (GObject *object,
{
g_printerr (_("Error ejecting mount: %s\n"), error->message);
success = FALSE;
+ g_error_free (error);
}
outstanding_mounts--;
@@ -411,6 +418,7 @@ eject (GFile *file)
{
g_printerr (_("Error finding enclosing mount: %s\n"), error->message);
success = FALSE;
+ g_error_free (error);
return;
}
@@ -867,6 +875,7 @@ mount_with_device_file_cb (GObject *object,
g_printerr (_("Error mounting %s: %s\n"),
g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE),
error->message);
+ g_error_free (error);
success = FALSE;
}
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]