ALL: Valgrind warnings in our file-handling classes
|Reported by:||eriktorbjorn||Owned by:||eriktorbjorn|
I just had a strange problem when trying to start Kyra 1. Two or three times in a row, ScummVM complained that it couldn't find any game in the specified directory. I haven't been able to reproduce that since then, but it did prompt me to run Valgrind.
It seems that when starting *some* games, Valgrind will warn about uninitialized variable(s) in our file-handling classes. The warnings seem to indicate that _isDirectory isn't initialized, but so far I've been unable to figure out why. Maybe Valgrind is imagining things, but that doesn't explain the problem I had...
Since Valgrind is very slow, I only tried a couple of games. I got warning messages for Kyra 1, Broken Sword 2 and Simon the Sorcerer 1, but not for Monkey Island 2, Beneath a Steel Sky or Flight of the Amazon Queen.
There seemed to be two different warnings: One about File::exists(), and one about FilesystemNode::listDir().
==31046== Conditional jump or move depends on uninitialised value(s) ==31046== at 0x81059F7: Common::File::exists(Common::String const&) (file.cpp:312) ==31046== by 0x4D9F6CD: Kyra::KyraEngine_v1::setupGameFlags() (plugin.cpp:276) ==31046== by 0x4D9DE07: Kyra::KyraEngine::init() (kyra.cpp:109) ==31046== by 0x807627B: runGame(Plugin const*, OSystem&, Common::String const&) (main.cpp:244) ==31046== by 0x8076EFE: scummvm_main (main.cpp:362) ==31046== by 0x8074271: main (sdl.cpp:99)
==31834== at 0x80FD382: FilesystemNode::listDir(FSList&, FilesystemNode::ListMode) const (fs.cpp:103) ==31834== by 0x8104C8F: Common::File::addDefaultDirectoryRecursive(FilesystemNode const&, int) (file.cpp:128) ==31834== by 0x8104F52: Common::File::addDefaultDirectory(Common::String const&) (file.cpp:111) ==31834== by 0x4CB761A: Sword2::Sword2Engine::Sword2Engine(OSystem*) (sword2.cpp:126) ==31834== by 0x4CB798F: Engine_SWORD2_create(OSystem*, Engine**) (sword2.cpp:116) ==31834== by 0x4CB79C7: PLUGIN_createEngine (sword2.cpp:120) ==31834== by 0x807D7FA: DynamicPlugin::createInstance(OSystem*, Engine**) const (plugins.cpp:162) ==31834== by 0x8075CB7: runGame(Plugin const*, OSystem&, Common::String const&) (main.cpp:201) ==31834== by 0x8076EFE: scummvm_main (main.cpp:362) ==31834== by 0x8074271: main (sdl.cpp:99)
Ticket imported from: #1483450. Ticket imported from: bugs/2599.