mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 00:06:59 +02:00
Fix a memory leak in ma_sound_init_copy().
Public issue https://github.com/mackron/miniaudio/issues/667
This commit is contained in:
+4
-1
@@ -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)
|
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);
|
pSound->pResourceManagerDataSource = (ma_resource_manager_data_source*)ma_malloc(sizeof(*pSound->pResourceManagerDataSource), &pEngine->allocationCallbacks);
|
||||||
if (pSound->pResourceManagerDataSource == NULL) {
|
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;
|
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;
|
return MA_SUCCESS;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user