summaryrefslogtreecommitdiff
path: root/src/demuxers/demux_film.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/demuxers/demux_film.c')
-rw-r--r--src/demuxers/demux_film.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/demuxers/demux_film.c b/src/demuxers/demux_film.c
index 13036afc1..dcd57f76c 100644
--- a/src/demuxers/demux_film.c
+++ b/src/demuxers/demux_film.c
@@ -141,9 +141,9 @@ static int open_film_file(demux_film_t *film) {
return 0;
/* FILM signature correct? */
- if (strncmp(scratch, "FILM", 4)) {
+ if (!_x_is_fourcc(scratch, "FILM"))
return 0;
- }
+
llprintf(DEBUG_FILM_LOAD, "found 'FILM' signature\n");
/* file is qualified; skip over the header bytes in the stream */
@@ -151,7 +151,7 @@ static int open_film_file(demux_film_t *film) {
/* header size = header size - 16-byte FILM signature */
film_header_size = _X_BE_32(&scratch[4]) - 16;
- film_header = xine_xmalloc(film_header_size);
+ film_header = malloc(film_header_size);
if (!film_header)
return 0;
strncpy(film->version, &scratch[8], 4);
@@ -256,7 +256,9 @@ static int open_film_file(demux_film_t *film) {
film->frequency = _X_BE_32(&film_header[i + 8]);
film->sample_count = _X_BE_32(&film_header[i + 12]);
film->sample_table =
- xine_xmalloc(film->sample_count * sizeof(film_sample_t));
+ calloc(film->sample_count, sizeof(film_sample_t));
+ if (!film->sample_table)
+ goto film_abort;
for (j = 0; j < film->sample_count; j++) {
film->sample_table[j].sample_offset =
@@ -329,15 +331,16 @@ static int open_film_file(demux_film_t *film) {
/* allocate enough space in the interleave preload buffer for the
* first chunk (which will be more than enough for successive chunks) */
if (film->audio_type) {
- if (film->interleave_buffer)
- free(film->interleave_buffer);
- film->interleave_buffer =
- xine_xmalloc(film->sample_table[0].sample_size);
+ free(film->interleave_buffer);
+ film->interleave_buffer = calloc(1, film->sample_table[0].sample_size);
+ if (!film->interleave_buffer)
+ goto film_abort;
}
break;
default:
xine_log(film->stream->xine, XINE_LOG_MSG, _("unrecognized FILM chunk\n"));
+ film_abort:
free (film->interleave_buffer);
free (film->sample_table);
free (film_header);
@@ -853,7 +856,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
demux_film_t *this;
- this = xine_xmalloc (sizeof (demux_film_t));
+ this = calloc(1, sizeof(demux_film_t));
this->stream = stream;
this->input = input;
@@ -927,7 +930,7 @@ static void class_dispose (demux_class_t *this_gen) {
void *demux_film_init_plugin (xine_t *xine, void *data) {
demux_film_class_t *this;
- this = xine_xmalloc (sizeof (demux_film_class_t));
+ this = calloc(1, sizeof(demux_film_class_t));
this->demux_class.open_plugin = open_plugin;
this->demux_class.get_description = get_description;