summaryrefslogtreecommitdiff
path: root/test/run_encoder.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'test/run_encoder.cxx')
-rw-r--r--test/run_encoder.cxx9
1 files changed, 4 insertions, 5 deletions
diff --git a/test/run_encoder.cxx b/test/run_encoder.cxx
index 234a86d3f..52857c2e8 100644
--- a/test/run_encoder.cxx
+++ b/test/run_encoder.cxx
@@ -29,6 +29,8 @@
#include "util/Error.hxx"
#include "Log.hxx"
+#include <memory>
+
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
@@ -65,7 +67,7 @@ int main(int argc, char **argv)
try {
Error error;
- const auto p_encoder = encoder_init(*plugin, block, error);
+ std::unique_ptr<PreparedEncoder> p_encoder(encoder_init(*plugin, block, error));
if (p_encoder == nullptr) {
LogError(error, "Failed to initialize encoder");
return EXIT_FAILURE;
@@ -81,7 +83,7 @@ int main(int argc, char **argv)
}
}
- auto *encoder = p_encoder->Open(audio_format, error);
+ std::unique_ptr<Encoder> encoder(p_encoder->Open(audio_format, error));
if (encoder == nullptr) {
LogError(error, "Failed to open encoder");
return EXIT_FAILURE;
@@ -110,9 +112,6 @@ int main(int argc, char **argv)
EncoderToOutputStream(os, *encoder);
- delete encoder;
- delete p_encoder;
-
return EXIT_SUCCESS;
} catch (const std::exception &e) {
LogError(e);