From f8570dd79f17f5c9237e83e262d468fa33c1a831 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Wed, 3 Apr 2019 14:22:32 +0200
Subject: [PATCH] encoder/opus: use new[] instead of xalloc()

---
 src/encoder/plugins/OpusEncoderPlugin.cxx | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/encoder/plugins/OpusEncoderPlugin.cxx b/src/encoder/plugins/OpusEncoderPlugin.cxx
index 64c2aa617..b1da41141 100644
--- a/src/encoder/plugins/OpusEncoderPlugin.cxx
+++ b/src/encoder/plugins/OpusEncoderPlugin.cxx
@@ -21,7 +21,6 @@
 #include "OggEncoder.hxx"
 #include "AudioFormat.hxx"
 #include "config/Domain.hxx"
-#include "util/Alloc.hxx"
 #include "util/ByteOrder.hxx"
 #include "util/StringUtil.hxx"
 
@@ -134,7 +133,7 @@ OpusEncoder::OpusEncoder(AudioFormat &_audio_format, ::OpusEncoder *_enc, bool _
 	 frame_size(_audio_format.GetFrameSize()),
 	 buffer_frames(_audio_format.sample_rate / 50),
 	 buffer_size(frame_size * buffer_frames),
-	 buffer((unsigned char *)xalloc(buffer_size)),
+	 buffer(new uint8_t[buffer_size]),
 	 enc(_enc)
 {
 	opus_encoder_ctl(enc, OPUS_GET_LOOKAHEAD(&lookahead));
@@ -181,7 +180,7 @@ PreparedOpusEncoder::Open(AudioFormat &audio_format)
 
 OpusEncoder::~OpusEncoder()
 {
-	free(buffer);
+	delete[] buffer;
 	opus_encoder_destroy(enc);
 }
 
@@ -325,7 +324,7 @@ OpusEncoder::GenerateTags(const Tag *tag)
 		}
 	}
 
-	unsigned char *comments = (unsigned char *)xalloc(comments_size);
+	unsigned char *comments = new unsigned char[comments_size];
 	unsigned char *p = comments;
 
 	memcpy(comments, "OpusTags", 8);
@@ -369,7 +368,7 @@ OpusEncoder::GenerateTags(const Tag *tag)
 	stream.PacketIn(packet);
 	Flush();
 
-	free(comments);
+	delete[] comments;
 }
 
 void