Ticket #4744: libs_libmyth_mediamonitor-unix.cpp-fix-null-check-too-late.patch

File libs_libmyth_mediamonitor-unix.cpp-fix-null-check-too-late.patch, 941 bytes (added by Erik Hovland <erik@…>, 13 years ago)

Moves the check for null pointer before the pointer is dereferenced

  • libs/libmyth/mediamonitor-unix.cpp

    
    From: Erik Hovland <erik@hovland.org>
    
    
    ---
    
     libs/libmyth/mediamonitor-unix.cpp |    6 +++---
     1 files changed, 3 insertions(+), 3 deletions(-)
    
    diff --git a/libs/libmyth/mediamonitor-unix.cpp b/libs/libmyth/mediamonitor-unix.cpp
    index 2b9cc43..f381467 100644
    a b bool MediaMonitorUnix::AddDevice(MythMediaDevice* pDevice) 
    371371// Given a fstab entry to a media device determine what type of device it is
    372372bool MediaMonitorUnix::AddDevice(struct fstab * mep)
    373373{
     374    if (!mep)
     375        return false;
     376
    374377    QString devicePath( mep->fs_spec );
    375378    //cout << "AddDevice - " << devicePath << endl;
    376379
    bool MediaMonitorUnix::AddDevice(struct fstab * mep) 
    380383    bool is_supermount = false;
    381384    bool is_cdrom = false;
    382385
    383     if (mep == NULL)
    384        return false;
    385 
    386386    if (stat(mep->fs_spec, &sbuf) < 0)
    387387       return false;
    388388