decoder/mad: use new[] instead of g_malloc()
This commit is contained in:
@@ -32,17 +32,17 @@
|
|||||||
#include "util/Domain.hxx"
|
#include "util/Domain.hxx"
|
||||||
#include "Log.hxx"
|
#include "Log.hxx"
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <glib.h>
|
|
||||||
#include <mad.h>
|
#include <mad.h>
|
||||||
|
|
||||||
#ifdef HAVE_ID3TAG
|
#ifdef HAVE_ID3TAG
|
||||||
#include <id3tag.h>
|
#include <id3tag.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#define FRAMES_CUSHION 2000
|
#define FRAMES_CUSHION 2000
|
||||||
|
|
||||||
#define READ_BUFFER_SIZE 40960
|
#define READ_BUFFER_SIZE 40960
|
||||||
@@ -349,14 +349,14 @@ MadDecoder::ParseId3(size_t tagsize, Tag **mpd_tag)
|
|||||||
id3_data = stream.this_frame;
|
id3_data = stream.this_frame;
|
||||||
mad_stream_skip(&(stream), tagsize);
|
mad_stream_skip(&(stream), tagsize);
|
||||||
} else {
|
} else {
|
||||||
allocated = (id3_byte_t *)g_malloc(tagsize);
|
allocated = new id3_byte_t[tagsize];
|
||||||
memcpy(allocated, stream.this_frame, count);
|
memcpy(allocated, stream.this_frame, count);
|
||||||
mad_stream_skip(&(stream), count);
|
mad_stream_skip(&(stream), count);
|
||||||
|
|
||||||
if (!decoder_read_full(decoder, input_stream,
|
if (!decoder_read_full(decoder, input_stream,
|
||||||
allocated + count, tagsize - count)) {
|
allocated + count, tagsize - count)) {
|
||||||
LogDebug(mad_domain, "error parsing ID3 tag");
|
LogDebug(mad_domain, "error parsing ID3 tag");
|
||||||
g_free(allocated);
|
delete[] allocated;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -365,7 +365,7 @@ MadDecoder::ParseId3(size_t tagsize, Tag **mpd_tag)
|
|||||||
|
|
||||||
id3_tag = id3_tag_parse(id3_data, tagsize);
|
id3_tag = id3_tag_parse(id3_data, tagsize);
|
||||||
if (id3_tag == nullptr) {
|
if (id3_tag == nullptr) {
|
||||||
g_free(allocated);
|
delete[] allocated;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -390,7 +390,7 @@ MadDecoder::ParseId3(size_t tagsize, Tag **mpd_tag)
|
|||||||
|
|
||||||
id3_tag_delete(id3_tag);
|
id3_tag_delete(id3_tag);
|
||||||
|
|
||||||
g_free(allocated);
|
delete[] allocated;
|
||||||
#else /* !HAVE_ID3TAG */
|
#else /* !HAVE_ID3TAG */
|
||||||
(void)mpd_tag;
|
(void)mpd_tag;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user