diff options
author | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-12-18 21:38:21 +0100 |
---|---|---|
committer | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-12-18 21:38:21 +0100 |
commit | e3ab135aff25bcb39f9d536784f08fb16945264a (patch) | |
tree | 38506894073bb4a76d0b7f496cfd43e90df63f1c /src | |
parent | 528cbe3723dcdafc6eb80817721ea5cf6fb9b050 (diff) | |
download | xine-lib-e3ab135aff25bcb39f9d536784f08fb16945264a.tar.gz xine-lib-e3ab135aff25bcb39f9d536784f08fb16945264a.tar.bz2 |
Use automatic buffers rather than malloc/free the buffer.
Diffstat (limited to 'src')
-rw-r--r-- | src/demuxers/id3.c | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/src/demuxers/id3.c b/src/demuxers/id3.c index 4149c0512..ceb66014f 100644 --- a/src/demuxers/id3.c +++ b/src/demuxers/id3.c @@ -273,15 +273,9 @@ static int id3v22_parse_frame_header(input_plugin_t *input, static int id3v22_interp_frame(input_plugin_t *input, xine_stream_t *stream, id3v22_frame_header_t *frame_header) { - char *buf; + char buf[frame_header->size + 1]; int enc; - buf = malloc(frame_header->size + 1); - if (buf == NULL) { - lprintf("malloc error"); - return 0; - } - if (input->read (input, buf, frame_header->size) == frame_header->size) { buf[frame_header->size] = 0; enc = buf[0]; @@ -327,11 +321,9 @@ static int id3v22_interp_frame(input_plugin_t *input, lprintf("unhandled frame\n"); } - free(buf); return 1; } else { lprintf("read error\n"); - free(buf); return 0; } } @@ -467,15 +459,9 @@ static int id3v23_parse_frame_ext_header(input_plugin_t *input, static int id3v23_interp_frame(input_plugin_t *input, xine_stream_t *stream, id3v23_frame_header_t *frame_header) { - char *buf; + char buf[frame_header->size + 1]; int enc; - buf = malloc(frame_header->size + 1); - if (buf == NULL) { - lprintf("malloc error"); - return 0; - } - if (input->read (input, buf, frame_header->size) == frame_header->size) { buf[frame_header->size] = 0; enc = buf[0]; @@ -521,11 +507,9 @@ static int id3v23_interp_frame(input_plugin_t *input, lprintf("unhandled frame\n"); } - free(buf); return 1; } else { lprintf("read error\n"); - free(buf); return 0; } } @@ -716,15 +700,9 @@ static int id3v24_parse_ext_header(input_plugin_t *input, static int id3v24_interp_frame(input_plugin_t *input, xine_stream_t *stream, id3v24_frame_header_t *frame_header) { - char *buf; + char buf[frame_header->size + 1]; int enc; - buf = malloc(frame_header->size + 1); - if (buf == NULL) { - lprintf("malloc error"); - return 0; - } - if (input->read (input, buf, frame_header->size) == frame_header->size) { buf[frame_header->size] = 0; enc = buf[0]; @@ -772,11 +750,9 @@ static int id3v24_interp_frame(input_plugin_t *input, lprintf("unhandled frame\n"); } - free(buf); return 1; } else { lprintf("read error\n"); - free(buf); return 0; } } |