Commit 9f446079 authored by David Reid's avatar David Reid

Fix memory leaks.

parent 022b3851
...@@ -38,6 +38,7 @@ static ma_result ma_decoding_backend_init__libvorbis(void* pUserData, ma_read_pr ...@@ -38,6 +38,7 @@ static ma_result ma_decoding_backend_init__libvorbis(void* pUserData, ma_read_pr
result = ma_libvorbis_init(onRead, onSeek, onTell, pReadSeekTellUserData, pConfig, pAllocationCallbacks, pVorbis); result = ma_libvorbis_init(onRead, onSeek, onTell, pReadSeekTellUserData, pConfig, pAllocationCallbacks, pVorbis);
if (result != MA_SUCCESS) { if (result != MA_SUCCESS) {
ma_free(pVorbis, pAllocationCallbacks);
return result; return result;
} }
...@@ -60,6 +61,7 @@ static ma_result ma_decoding_backend_init_file__libvorbis(void* pUserData, const ...@@ -60,6 +61,7 @@ static ma_result ma_decoding_backend_init_file__libvorbis(void* pUserData, const
result = ma_libvorbis_init_file(pFilePath, pConfig, pAllocationCallbacks, pVorbis); result = ma_libvorbis_init_file(pFilePath, pConfig, pAllocationCallbacks, pVorbis);
if (result != MA_SUCCESS) { if (result != MA_SUCCESS) {
ma_free(pVorbis, pAllocationCallbacks);
return result; return result;
} }
...@@ -113,6 +115,7 @@ static ma_result ma_decoding_backend_init__libopus(void* pUserData, ma_read_proc ...@@ -113,6 +115,7 @@ static ma_result ma_decoding_backend_init__libopus(void* pUserData, ma_read_proc
result = ma_libopus_init(onRead, onSeek, onTell, pReadSeekTellUserData, pConfig, pAllocationCallbacks, pOpus); result = ma_libopus_init(onRead, onSeek, onTell, pReadSeekTellUserData, pConfig, pAllocationCallbacks, pOpus);
if (result != MA_SUCCESS) { if (result != MA_SUCCESS) {
ma_free(pOpus, pAllocationCallbacks);
return result; return result;
} }
...@@ -135,6 +138,7 @@ static ma_result ma_decoding_backend_init_file__libopus(void* pUserData, const c ...@@ -135,6 +138,7 @@ static ma_result ma_decoding_backend_init_file__libopus(void* pUserData, const c
result = ma_libopus_init_file(pFilePath, pConfig, pAllocationCallbacks, pOpus); result = ma_libopus_init_file(pFilePath, pConfig, pAllocationCallbacks, pOpus);
if (result != MA_SUCCESS) { if (result != MA_SUCCESS) {
ma_free(pOpus, pAllocationCallbacks);
return result; return result;
} }
......
...@@ -39,6 +39,7 @@ static ma_result ma_decoding_backend_init__libvorbis(void* pUserData, ma_read_pr ...@@ -39,6 +39,7 @@ static ma_result ma_decoding_backend_init__libvorbis(void* pUserData, ma_read_pr
result = ma_libvorbis_init(onRead, onSeek, onTell, pReadSeekTellUserData, pConfig, pAllocationCallbacks, pVorbis); result = ma_libvorbis_init(onRead, onSeek, onTell, pReadSeekTellUserData, pConfig, pAllocationCallbacks, pVorbis);
if (result != MA_SUCCESS) { if (result != MA_SUCCESS) {
ma_free(pVorbis, pAllocationCallbacks);
return result; return result;
} }
...@@ -61,6 +62,7 @@ static ma_result ma_decoding_backend_init_file__libvorbis(void* pUserData, const ...@@ -61,6 +62,7 @@ static ma_result ma_decoding_backend_init_file__libvorbis(void* pUserData, const
result = ma_libvorbis_init_file(pFilePath, pConfig, pAllocationCallbacks, pVorbis); result = ma_libvorbis_init_file(pFilePath, pConfig, pAllocationCallbacks, pVorbis);
if (result != MA_SUCCESS) { if (result != MA_SUCCESS) {
ma_free(pVorbis, pAllocationCallbacks);
return result; return result;
} }
...@@ -114,6 +116,7 @@ static ma_result ma_decoding_backend_init__libopus(void* pUserData, ma_read_proc ...@@ -114,6 +116,7 @@ static ma_result ma_decoding_backend_init__libopus(void* pUserData, ma_read_proc
result = ma_libopus_init(onRead, onSeek, onTell, pReadSeekTellUserData, pConfig, pAllocationCallbacks, pOpus); result = ma_libopus_init(onRead, onSeek, onTell, pReadSeekTellUserData, pConfig, pAllocationCallbacks, pOpus);
if (result != MA_SUCCESS) { if (result != MA_SUCCESS) {
ma_free(pOpus, pAllocationCallbacks);
return result; return result;
} }
...@@ -136,6 +139,7 @@ static ma_result ma_decoding_backend_init_file__libopus(void* pUserData, const c ...@@ -136,6 +139,7 @@ static ma_result ma_decoding_backend_init_file__libopus(void* pUserData, const c
result = ma_libopus_init_file(pFilePath, pConfig, pAllocationCallbacks, pOpus); result = ma_libopus_init_file(pFilePath, pConfig, pAllocationCallbacks, pOpus);
if (result != MA_SUCCESS) { if (result != MA_SUCCESS) {
ma_free(pOpus, pAllocationCallbacks);
return result; return result;
} }
......
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