Commit 94e7b643 authored by Alexander Saoutkin's avatar Alexander Saoutkin
Browse files

[KIO-MTP] Fix null pointer dereference

A null pointer can be returned from getDevice() if a device is disconnected.
Passing NULL into LIBMTP_Get_Storage() results in a NULL pointer dereference.

BUG: 405838

Test Plan:
Compiles. I couldn't reproduce this as described in the bug report, but from
reading the attached stacktrace in the bug report it's obvious what went wrong

Reviewers: akrutzler, dfaure, elvisangelaccio

Reviewed By: elvisangelaccio

Subscribers: anthonyfieroni, kde-frameworks-devel, fvogt, kfm-devel, ngraham

Tags: #dolphin, #frameworks

Differential Revision:
parent 8c3c27da
......@@ -75,12 +75,6 @@ MTPDevice::~MTPDevice()
LIBMTP_mtpdevice_t *MTPDevice::getDevice()
if (!m_mtpdevice->storage) {
qCDebug(LOG_KIOD_KMTPD) << "no storage found: reopen mtpdevice";
m_mtpdevice = LIBMTP_Open_Raw_Device_Uncached(&m_rawdevice);
return m_mtpdevice;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment