Commit ca91b230 authored by Linshizhi's avatar Linshizhi

cleanup bug fix

parent 2401d0dc
...@@ -111,7 +111,7 @@ int audioMixArbitary(int numOfAudios, AudioFile *files[], AudioFile *o_file) { ...@@ -111,7 +111,7 @@ int audioMixArbitary(int numOfAudios, AudioFile *files[], AudioFile *o_file) {
for (int i = 0; i < numOfAudios; ++i) { for (int i = 0; i < numOfAudios; ++i) {
audio_ctx[i] = open_audio_file(files[i]); audio_ctx[i] = open_audio_file(files[i]);
if (audio_ctx[i] == NULL) { if (audio_ctx[i] == NULL) {
printf("Failed to open audio file: %s", files[i]->filepath); printf("Failed to open audio file: %s\n", files[i]->filepath);
goto FAIL; goto FAIL;
} }
} }
...@@ -142,12 +142,16 @@ int audioMixArbitary(int numOfAudios, AudioFile *files[], AudioFile *o_file) { ...@@ -142,12 +142,16 @@ int audioMixArbitary(int numOfAudios, AudioFile *files[], AudioFile *o_file) {
err = 1; err = 1;
CLEANUP: CLEANUP:
audioStreamCtx_Release_free(&output_ctx); if (output_ctx)
audioStreamCtx_Release_free(&output_ctx);
for (int i = 0; i < numOfAudios; ++i) { for (int i = 0; i < numOfAudios; ++i) {
audioStreamCtx_Release_free(&audio_ctx[i]); if (audio_ctx[i])
audioStreamCtx_Release_free(&audio_ctx[i]);
} }
free(audio_ctx); free(audio_ctx);
filterCtx_Release(&filter_ctx); if (filter_ctx)
filterCtx_Release(&filter_ctx);
return err; return err;
} }
......
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