Commit 240a697f authored by Max Kellermann's avatar Max Kellermann

encoder/opus: use xalloc() instead of g_malloc()

parent 5a0dc808
......@@ -24,6 +24,7 @@
#include "../EncoderAPI.hxx"
#include "AudioFormat.hxx"
#include "config/ConfigError.hxx"
#include "util/Alloc.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx"
#include "system/ByteOrder.hxx"
......@@ -31,8 +32,6 @@
#include <opus.h>
#include <ogg/ogg.h>
#include <glib.h>
#include <assert.h>
#include <stdlib.h>
......@@ -188,7 +187,7 @@ opus_encoder_open(Encoder *_encoder,
encoder->buffer_frames = audio_format.sample_rate / 50;
encoder->buffer_size = encoder->frame_size * encoder->buffer_frames;
encoder->buffer_position = 0;
encoder->buffer = (unsigned char *)g_malloc(encoder->buffer_size);
encoder->buffer = (unsigned char *)xalloc(encoder->buffer_size);
encoder->stream.Initialize(GenerateOggSerial());
encoder->packetno = 0;
......@@ -202,7 +201,7 @@ opus_encoder_close(Encoder *_encoder)
struct opus_encoder *encoder = (struct opus_encoder *)_encoder;
encoder->stream.Deinitialize();
g_free(encoder->buffer);
free(encoder->buffer);
opus_encoder_destroy(encoder->enc);
}
......@@ -366,7 +365,7 @@ opus_encoder_generate_tags(struct opus_encoder *encoder)
size_t version_length = strlen(version);
size_t comments_size = 8 + 4 + version_length + 4;
unsigned char *comments = (unsigned char *)g_malloc(comments_size);
unsigned char *comments = (unsigned char *)xalloc(comments_size);
memcpy(comments, "OpusTags", 8);
*(uint32_t *)(comments + 8) = ToLE32(version_length);
memcpy(comments + 12, version, version_length);
......@@ -382,7 +381,7 @@ opus_encoder_generate_tags(struct opus_encoder *encoder)
encoder->stream.PacketIn(packet);
encoder->stream.Flush();
g_free(comments);
free(comments);
}
static size_t
......
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