Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
53c69cd2
Commit
53c69cd2
authored
Dec 04, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TagId3: use new[]/delete[] instead of g_malloc()/g_free()
parent
c6cf8e99
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
11 deletions
+6
-11
TagId3.cxx
src/tag/TagId3.cxx
+6
-11
No files found.
src/tag/TagId3.cxx
View file @
53c69cd2
...
...
@@ -36,7 +36,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
# ifndef ID3_FRAME_COMPOSER
...
...
@@ -430,20 +429,16 @@ tag_id3_read(FILE *stream, long offset, int whence)
if
(
tag_size
<=
0
)
return
nullptr
;
/* Found a tag. Allocate a buffer and read it in. */
id3_byte_t
*
tag_buffer
=
(
id3_byte_t
*
)
g_malloc
(
tag_size
);
if
(
!
tag_buffer
)
return
nullptr
;
id3_byte_t
*
tag_buffer
=
new
id3_byte_t
[
tag_size
];
int
tag_buffer_size
=
fill_buffer
(
tag_buffer
,
tag_size
,
stream
,
offset
,
whence
);
if
(
tag_buffer_size
<
tag_size
)
{
g_free
(
tag_buffer
)
;
delete
[]
tag_buffer
;
return
nullptr
;
}
tag
=
id3_tag_parse
(
tag_buffer
,
tag_buffer_size
);
g_free
(
tag_buffer
);
delete
[]
tag_buffer
;
return
tag
;
}
...
...
@@ -524,16 +519,16 @@ tag_id3_riff_aiff_load(FILE *file)
/* too large, don't allocate so much memory */
return
nullptr
;
id3_byte_t
*
buffer
=
(
id3_byte_t
*
)
g_malloc
(
size
)
;
id3_byte_t
*
buffer
=
new
id3_byte_t
[
size
]
;
size_t
ret
=
fread
(
buffer
,
size
,
1
,
file
);
if
(
ret
!=
1
)
{
LogWarning
(
id3_domain
,
"Failed to read RIFF chunk"
);
g_free
(
buffer
)
;
delete
[]
buffer
;
return
nullptr
;
}
struct
id3_tag
*
tag
=
id3_tag_parse
(
buffer
,
size
);
g_free
(
buffer
)
;
delete
[]
buffer
;
return
tag
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment