Skip to content

Commit

Permalink
lib/sound/openal_track.cpp: fix use-after-free pointed by gcc-15
Browse files Browse the repository at this point in the history
`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;
          |                        ^~~~~~
  • Loading branch information
trofi authored and past-due committed Aug 26, 2024
1 parent 84b93d9 commit eaacca9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/sound/openal_track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1034,9 +1034,9 @@ AUDIO_STREAM *sound_PlayStream(const char* fileName, bool bufferEntireStream,
alDeleteBuffers(buffer_count, alBuffersIds);

_error:
alDeleteSources(1, &stream->source);
delete stream;
delete decoder;
alDeleteSources(1, &stream->source);
return nullptr;
}

Expand Down

0 comments on commit eaacca9

Please sign in to comment.