Commit ae25dbcd authored by David Reid's avatar David Reid

Fix a memory leak in ma_sound_init_copy().

Public issue https://github.com/mackron/miniaudio/issues/667
parent 4326fad9
......@@ -75444,7 +75444,7 @@ MA_API ma_result ma_sound_init_copy(ma_engine* pEngine, const ma_sound* pExistin
/*
We need to make a clone of the data source. If the data source is not a data buffer (i.e. a stream)
the this will fail.
this will fail.
*/
pSound->pResourceManagerDataSource = (ma_resource_manager_data_source*)ma_malloc(sizeof(*pSound->pResourceManagerDataSource), &pEngine->allocationCallbacks);
if (pSound->pResourceManagerDataSource == NULL) {
......@@ -75472,6 +75472,9 @@ MA_API ma_result ma_sound_init_copy(ma_engine* pEngine, const ma_sound* pExistin
return result;
}
/* Make sure the sound is marked as the owner of the data source or else it will never get uninitialized. */
pSound->ownsDataSource = MA_TRUE;
return MA_SUCCESS;
}
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment