Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib/sound/openal_track.cpp: fix use-after-free pointed by gcc-15 #4051

Merged
merged 1 commit into from
Aug 26, 2024

Conversation

trofi
Copy link
Contributor

@trofi trofi commented Aug 24, 2024

gcc-15 detects use-after-free as:

lib/sound/openal_track.cpp: In function 'AUDIO_STREAM* sound_PlayStream(const char*, bool, float, const std::function<void(const AUDIO_STREAM*, const void*)>&, const void*)':
lib/sound/openal_track.cpp:1039:36: error: pointer used after 'void operator delete(void*, std::size_t)' [-Werror=use-after-free]
 1039 |                 alDeleteSources(1, &stream->source);
      |                                    ^~~~~~~~~~~~~~~
lib/sound/openal_track.cpp:1037:24: note: call to 'void operator delete(void*, std::size_t)' here
 1037 |                 delete stream;
      |                        ^~~~~~

`gcc-15` detects use-after-free as:

    lib/sound/openal_track.cpp: In function 'AUDIO_STREAM* sound_PlayStream(const char*, bool, float, const std::function<void(const AUDIO_STREAM*, const void*)>&, const void*)':
    lib/sound/openal_track.cpp:1039:36: error: pointer used after 'void operator delete(void*, std::size_t)' [-Werror=use-after-free]
     1039 |                 alDeleteSources(1, &stream->source);
          |                                    ^~~~~~~~~~~~~~~
    lib/sound/openal_track.cpp:1037:24: note: call to 'void operator delete(void*, std::size_t)' here
     1037 |                 delete stream;
          |                        ^~~~~~
@past-due past-due added this to the 4.5.3 milestone Aug 25, 2024
@past-due past-due merged commit eaacca9 into Warzone2100:master Aug 26, 2024
37 checks passed
@trofi trofi deleted the gcc-15-build-fix branch August 26, 2024 05:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants