D28535: [KIO-MTP] Fix null pointer dereference

Fabian Vogt noreply at phabricator.kde.org
Fri Apr 3 13:04:35 BST 2020


fvogt added a comment.


  There is no such thing as an "invalid device" at that point anymore. There's only nullptr.
  
    LIBMTP_mtpdevice_t *MTPDevice::getDevice()
    {
        if (!m_mtpdevice->storage) {
            qCDebug(LOG_KIOD_KMTPD) << "no storage found: reopen mtpdevice";
            LIBMTP_Release_Device(m_mtpdevice);
            m_mtpdevice = LIBMTP_Open_Raw_Device_Uncached(&m_rawdevice);
        }
    
        return m_mtpdevice;
    }
  
  What you're suggesting is to change `MTPDevice::getDevice` to return the old device if reopening fails - but reopening without releasing might not work.

REPOSITORY
  R320 KIO Extras

REVISION DETAIL
  https://phabricator.kde.org/D28535

To: feverfew, akrutzler, dfaure, elvisangelaccio
Cc: anthonyfieroni, kde-frameworks-devel, fvogt, kfm-devel, ngraham, nikolaik, pberestov, iasensio, fprice, LeGast00n, cblack, fbampaloukas, alexde, GB_2, Codezela, feverfew, meven, michaelh, spoorun, navarromorales, firef, andrebarros, bruns, emmanuelp, mikesomov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20200403/4dac3019/attachment.htm>


More information about the kfm-devel mailing list