Commit 302ecf00 authored by philipjsg's avatar philipjsg

* Fix a problem caused by a duplicate free of priv_data -- now uses av_freep

* Make sure that the read buffer for the ffm file is allocated in the priv_data.


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@578 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent eecb2ffe
...@@ -172,7 +172,7 @@ static int ffm_write_header(AVFormatContext *s) ...@@ -172,7 +172,7 @@ static int ffm_write_header(AVFormatContext *s)
put_le16(pb, codec->frame_size); put_le16(pb, codec->frame_size);
break; break;
default: default:
abort(); av_abort();
} }
/* hack to have real time */ /* hack to have real time */
if (ffm_nopts) if (ffm_nopts)
...@@ -198,8 +198,7 @@ static int ffm_write_header(AVFormatContext *s) ...@@ -198,8 +198,7 @@ static int ffm_write_header(AVFormatContext *s)
fail: fail:
for(i=0;i<s->nb_streams;i++) { for(i=0;i<s->nb_streams;i++) {
st = s->streams[i]; st = s->streams[i];
fst = st->priv_data; av_freep(&st->priv_data);
av_free(fst);
} }
return -1; return -1;
} }
...@@ -251,7 +250,7 @@ static int ffm_write_trailer(AVFormatContext *s) ...@@ -251,7 +250,7 @@ static int ffm_write_trailer(AVFormatContext *s)
put_flush_packet(pb); put_flush_packet(pb);
for(i=0;i<s->nb_streams;i++) for(i=0;i<s->nb_streams;i++)
av_free(s->streams[i]->priv_data); av_freep(&s->streams[i]->priv_data);
return 0; return 0;
} }
...@@ -320,7 +319,7 @@ static int ffm_read_data(AVFormatContext *s, ...@@ -320,7 +319,7 @@ static int ffm_read_data(AVFormatContext *s,
} }
ffm->first_packet = 0; ffm->first_packet = 0;
if ((frame_offset & 0x7ffff) < FFM_HEADER_SIZE) if ((frame_offset & 0x7ffff) < FFM_HEADER_SIZE)
abort(); av_abort();
ffm->packet_ptr = ffm->packet + (frame_offset & 0x7fff) - FFM_HEADER_SIZE; ffm->packet_ptr = ffm->packet + (frame_offset & 0x7fff) - FFM_HEADER_SIZE;
if (!first) if (!first)
break; break;
...@@ -403,7 +402,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -403,7 +402,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
codec->frame_size = get_le16(pb); codec->frame_size = get_le16(pb);
break; break;
default: default:
abort(); av_abort();
} }
} }
...@@ -424,8 +423,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -424,8 +423,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
for(i=0;i<s->nb_streams;i++) { for(i=0;i<s->nb_streams;i++) {
st = s->streams[i]; st = s->streams[i];
if (st) { if (st) {
fst = st->priv_data; av_freep(&st->priv_data);
av_free(fst);
av_free(st); av_free(st);
} }
} }
...@@ -604,16 +602,16 @@ static int ffm_read_close(AVFormatContext *s) ...@@ -604,16 +602,16 @@ static int ffm_read_close(AVFormatContext *s)
for(i=0;i<s->nb_streams;i++) { for(i=0;i<s->nb_streams;i++) {
st = s->streams[i]; st = s->streams[i];
av_free(st->priv_data); av_freep(&st->priv_data);
} }
av_free(s->priv_data); av_freep(&s->priv_data);
return 0; return 0;
} }
AVInputFormat ffm_iformat = { AVInputFormat ffm_iformat = {
"ffm", "ffm",
"ffm format", "ffm format",
sizeof(FFMContext), sizeof(FFMContext) + FFM_PACKET_SIZE,
NULL, NULL,
ffm_read_header, ffm_read_header,
ffm_read_packet, ffm_read_packet,
......
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