speed-dreams-code/src
Xavier Del Campo Romero 6d7088adf5
OsgScenery.cpp: Fix undefined behaviour on delete
SDTrack was taking the ownership for track, a pointer to tTrack
allocated many layers above SDScenery::LoadScene. More specifically, it
is allocated by either TrackBuildEx or TrackBuildv1, and both would
allocate the tTrack instance via calloc(3) instead of C++'s new.

Attempting to `delete` a pointer *not* allocated by a previous call to
`new` is undefined behaviour according to the C++ standard. [1]

In fact, SDScenery::LoadScene did not even attempt to modify the
tTrack instance, so there was no need to take its ownership in the first
place.

[1]: https://en.cppreference.com/w/cpp/language/delete
2025-01-19 09:55:05 +01:00
..
drivers Support reading car data from GfLocalDir() 2025-01-19 09:55:05 +01:00
interfaces Look for driver name instead of index 2024-12-25 07:38:00 +01:00
libs Support reading car data from GfLocalDir() 2025-01-19 09:55:05 +01:00
main cmake: Replace SOURCE_DIR with CMAKE_SOURCE_DIR 2025-01-19 08:19:23 +01:00
modules OsgScenery.cpp: Fix undefined behaviour on delete 2025-01-19 09:55:05 +01:00
tools cmake: Replace SOURCE_DIR with CMAKE_SOURCE_DIR 2025-01-19 08:19:23 +01:00
CMakeLists.txt Remove trailing newlines 2024-07-30 22:17:48 +00:00