Fix cleanup order

The order of cleanup was not the reverse as the initialization order. As
a consequence, recorder_destroy() could theoretically be called even if
recorder_init() failed.
This commit is contained in:
Romain Vimont 2019-03-02 18:09:55 +01:00
parent bcd4090d51
commit 8aeb5c0e3c

View file

@ -291,14 +291,14 @@ finally_stop_decoder:
// stop the server before decoder_join() to wake up the decoder // stop the server before decoder_join() to wake up the decoder
server_stop(&server); server_stop(&server);
decoder_join(&decoder); decoder_join(&decoder);
finally_destroy_file_handler:
file_handler_stop(&file_handler);
file_handler_join(&file_handler);
file_handler_destroy(&file_handler);
finally_destroy_recorder: finally_destroy_recorder:
if (options->record_filename) { if (options->record_filename) {
recorder_destroy(&recorder); recorder_destroy(&recorder);
} }
finally_destroy_file_handler:
file_handler_stop(&file_handler);
file_handler_join(&file_handler);
file_handler_destroy(&file_handler);
finally_destroy_video_buffer: finally_destroy_video_buffer:
video_buffer_destroy(&video_buffer); video_buffer_destroy(&video_buffer);
finally_destroy_server: finally_destroy_server: