System::getDriverInfo() corrupts

When running the code below in debug config, System::getDriverInfo() corrupts i. In the first loop i is 0 but after calling the function i is some bogus value 673198133. Note that all other output params give correct output.

FMOD::Studio::System* system{ nullptr };
ERRCHECK(FMOD::Studio::System::create(&system));

FMOD::System* core{ nullptr };
ERRCHECK(system->getCoreSystem(&core));

int num_drivers{};
ERRCHECK(core->getNumDrivers(&num_drivers));

for (int i = 0; i < num_drivers; ++i) {
    char name{};
    constexpr int kNameLength{ 256 };
    FMOD_GUID guid{};
    int system_rate{};
    FMOD_SPEAKERMODE mode{};
    int speaker_mode_channels{};
    ERRCHECK(core->getDriverInfo(i, &name, kNameLength, &guid, &system_rate, &mode, &speaker_mode_channels));
}

Hi,

Thanks for bringing this to our attention.

What version of the FMOD engine are you using?

Sorry, pebkac. Similar issue as here Studio::Bus::getPath() only returns once and corrupts?. You need to allocate sufficient memory before the call.

1 Like

Good to hear it is solved!