Fix crash when testing invalid MIDI file.
authorRobin Gareus <robin@gareus.org>
Thu, 26 Jul 2018 14:59:27 +0000 (16:59 +0200)
committerRobin Gareus <robin@gareus.org>
Thu, 26 Jul 2018 14:59:27 +0000 (16:59 +0200)
smf_delete() does not handle NULL pointers. This fixes a crash when
checking if a MIDI source is valid.

libs/evoral/src/SMF.cpp

index 9bffa598050951392982ce721e1af984709f5603..64dd4e6889a483f4043709ef7a1cce8247576d50 100644 (file)
@@ -100,7 +100,9 @@ SMF::test(const std::string& path)
        if (!test_smf) {
                return false;
        }
-       smf_delete(test_smf);
+       if (test_smf) {
+               smf_delete(test_smf);
+       }
        return true;
 }