diff options
author | Tomas Bzatek <tbzatek@redhat.com> | 2014-01-14 18:20:19 +0100 |
---|---|---|
committer | David Zeuthen <zeuthen@gmail.com> | 2014-01-20 12:21:40 -0800 |
commit | 4d867ff2a454a155828a2616cd674b1a8d018260 (patch) | |
tree | 3837f2c4c2a5448186430868f84902f0349ec9dc | |
parent | 3a384047123abc4a4fe2e81eb5dc4050746aa9e8 (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.c | 6 |
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), |