summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@redhat.com>2014-01-14 18:20:19 +0100
committerDavid Zeuthen <zeuthen@gmail.com>2014-01-20 12:21:40 -0800
commit4d867ff2a454a155828a2616cd674b1a8d018260 (patch)
tree3837f2c4c2a5448186430868f84902f0349ec9dc
parent3a384047123abc4a4fe2e81eb5dc4050746aa9e8 (diff)
Fix crash when loop-deleting non-loop device
When a non-loop device file is specified, a lookup succeeds but it's not a UDisks2.Loop object. This change prevents a crash when null pointer is passed further in the calls. https://bugzilla.redhat.com/show_bug.cgi?id=1036076 Signed-off-by: David Zeuthen <zeuthen@gmail.com>
-rw-r--r--tools/udisksctl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/udisksctl.c b/tools/udisksctl.c
index 97b0f17..209c0a3 100644
--- a/tools/udisksctl.c
+++ b/tools/udisksctl.c
@@ -1691,6 +1691,12 @@ handle_command_loop (gint *argc,
goto out;
}
+ if (udisks_object_peek_loop (object) == NULL)
+ {
+ g_printerr ("Error: specified object is not a loop device\n");
+ goto out;
+ }
+
delete_try_again:
error = NULL;
if (!udisks_loop_call_delete_sync (udisks_object_peek_loop (object),