diff --git a/test/dump_text_file.cxx b/test/dump_text_file.cxx index 20af5678f..92ac64a12 100644 --- a/test/dump_text_file.cxx +++ b/test/dump_text_file.cxx @@ -51,17 +51,14 @@ dump_input_stream(InputStreamPtr &&is) dump_text_file(tis); } - is->Lock(); + const ScopeLock protect(is->mutex); Error error; if (!is->Check(error)) { LogError(error); - is->Unlock(); return EXIT_FAILURE; } - is->Unlock(); - return 0; } diff --git a/test/run_input.cxx b/test/run_input.cxx index 4433611f8..757895124 100644 --- a/test/run_input.cxx +++ b/test/run_input.cxx @@ -49,7 +49,7 @@ tag_save(FILE *file, const Tag &tag) static int dump_input_stream(InputStream *is) { - is->Lock(); + const ScopeLock protect(is->mutex); /* print meta data */ @@ -84,12 +84,9 @@ dump_input_stream(InputStream *is) Error error; if (!is->Check(error)) { LogError(error); - is->Unlock(); return EXIT_FAILURE; } - is->Unlock(); - return 0; }