summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Gladstone <philipjsg@users.sourceforge.net>2002-05-24 01:19:27 +0000
committerPhilip Gladstone <philipjsg@users.sourceforge.net>2002-05-24 01:19:27 +0000
commit789bee12643162000cb1524ce018562fbc12a94e (patch)
treecb3a714770296595f8f68f7a59203f71fb7ce5c8
parentec3b22326dc07fb8300a577bd6b17c19a0f1bcf7 (diff)
* 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. Originally committed as revision 578 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libav/ffm.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/libav/ffm.c b/libav/ffm.c
index 8d05ca9c4a..a1858d2824 100644
--- a/libav/ffm.c
+++ b/libav/ffm.c
@@ -172,7 +172,7 @@ static int ffm_write_header(AVFormatContext *s)
put_le16(pb, codec->frame_size);
break;
default:
- abort();
+ av_abort();
}
/* hack to have real time */
if (ffm_nopts)
@@ -198,8 +198,7 @@ static int ffm_write_header(AVFormatContext *s)
fail:
for(i=0;i<s->nb_streams;i++) {
st = s->streams[i];
- fst = st->priv_data;
- av_free(fst);
+ av_freep(&st->priv_data);
}
return -1;
}
@@ -251,7 +250,7 @@ static int ffm_write_trailer(AVFormatContext *s)
put_flush_packet(pb);
for(i=0;i<s->nb_streams;i++)
- av_free(s->streams[i]->priv_data);
+ av_freep(&s->streams[i]->priv_data);
return 0;
}
@@ -320,7 +319,7 @@ static int ffm_read_data(AVFormatContext *s,
}
ffm->first_packet = 0;
if ((frame_offset & 0x7ffff) < FFM_HEADER_SIZE)
- abort();
+ av_abort();
ffm->packet_ptr = ffm->packet + (frame_offset & 0x7fff) - FFM_HEADER_SIZE;
if (!first)
break;
@@ -403,7 +402,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
codec->frame_size = get_le16(pb);
break;
default:
- abort();
+ av_abort();
}
}
@@ -424,8 +423,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
for(i=0;i<s->nb_streams;i++) {
st = s->streams[i];
if (st) {
- fst = st->priv_data;
- av_free(fst);
+ av_freep(&st->priv_data);
av_free(st);
}
}
@@ -604,16 +602,16 @@ static int ffm_read_close(AVFormatContext *s)
for(i=0;i<s->nb_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;
}
AVInputFormat ffm_iformat = {
"ffm",
"ffm format",
- sizeof(FFMContext),
+ sizeof(FFMContext) + FFM_PACKET_SIZE,
NULL,
ffm_read_header,
ffm_read_packet,