Commit 1ea4f593 authored by Fabrice Bellard's avatar Fabrice Bellard

use av memory handling functions

Originally committed as revision 528 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 06542267
...@@ -431,7 +431,7 @@ static int asf_write_header(AVFormatContext *s) ...@@ -431,7 +431,7 @@ static int asf_write_header(AVFormatContext *s)
asf->nb_packets = 0; asf->nb_packets = 0;
if (asf_write_header1(s, 0, 50) < 0) { if (asf_write_header1(s, 0, 50) < 0) {
free(asf); av_free(asf);
return -1; return -1;
} }
...@@ -615,7 +615,7 @@ static int asf_write_trailer(AVFormatContext *s) ...@@ -615,7 +615,7 @@ static int asf_write_trailer(AVFormatContext *s)
put_flush_packet(&s->pb); put_flush_packet(&s->pb);
free(asf); av_free(asf);
return 0; return 0;
} }
...@@ -869,10 +869,10 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -869,10 +869,10 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
for(i=0;i<s->nb_streams;i++) { for(i=0;i<s->nb_streams;i++) {
AVStream *st = s->streams[i]; AVStream *st = s->streams[i];
if (st) if (st)
free(st->priv_data); av_free(st->priv_data);
free(st); av_free(st);
} }
free(asf); av_free(asf);
return -1; return -1;
} }
...@@ -1009,9 +1009,9 @@ static int asf_read_close(AVFormatContext *s) ...@@ -1009,9 +1009,9 @@ static int asf_read_close(AVFormatContext *s)
for(i=0;i<s->nb_streams;i++) { for(i=0;i<s->nb_streams;i++) {
AVStream *st = s->streams[i]; AVStream *st = s->streams[i];
free(st->priv_data); av_free(st->priv_data);
} }
free(asf); av_free(asf);
return 0; return 0;
} }
......
...@@ -128,7 +128,7 @@ static int au_read_header(AVFormatContext *s, ...@@ -128,7 +128,7 @@ static int au_read_header(AVFormatContext *s,
} }
/* now we are ready: build format streams */ /* now we are ready: build format streams */
st = malloc(sizeof(AVStream)); st = av_malloc(sizeof(AVStream));
if (!st) if (!st)
return -1; return -1;
s->nb_streams = 1; s->nb_streams = 1;
......
...@@ -161,7 +161,7 @@ static int audio_write_header(AVFormatContext *s1) ...@@ -161,7 +161,7 @@ static int audio_write_header(AVFormatContext *s1)
s->channels = st->codec.channels; s->channels = st->codec.channels;
ret = audio_open(s, 1); ret = audio_open(s, 1);
if (ret < 0) { if (ret < 0) {
free(s); av_free(s);
return -EIO; return -EIO;
} else { } else {
return 0; return 0;
...@@ -201,7 +201,7 @@ static int audio_write_trailer(AVFormatContext *s1) ...@@ -201,7 +201,7 @@ static int audio_write_trailer(AVFormatContext *s1)
AudioData *s = s1->priv_data; AudioData *s = s1->priv_data;
audio_close(s); audio_close(s);
free(s); av_free(s);
return 0; return 0;
} }
...@@ -221,7 +221,7 @@ static int audio_read_header(AVFormatContext *s1, AVFormatParameters *ap) ...@@ -221,7 +221,7 @@ static int audio_read_header(AVFormatContext *s1, AVFormatParameters *ap)
return -ENOMEM; return -ENOMEM;
st = av_mallocz(sizeof(AVStream)); st = av_mallocz(sizeof(AVStream));
if (!st) { if (!st) {
free(s); av_free(s);
return -ENOMEM; return -ENOMEM;
} }
s1->priv_data = s; s1->priv_data = s;
...@@ -232,8 +232,8 @@ static int audio_read_header(AVFormatContext *s1, AVFormatParameters *ap) ...@@ -232,8 +232,8 @@ static int audio_read_header(AVFormatContext *s1, AVFormatParameters *ap)
ret = audio_open(s, 0); ret = audio_open(s, 0);
if (ret < 0) { if (ret < 0) {
free(st); av_free(st);
free(s); av_free(s);
return -EIO; return -EIO;
} else { } else {
/* take real parameters */ /* take real parameters */
...@@ -284,7 +284,7 @@ static int audio_read_close(AVFormatContext *s1) ...@@ -284,7 +284,7 @@ static int audio_read_close(AVFormatContext *s1)
AudioData *s = s1->priv_data; AudioData *s = s1->priv_data;
audio_close(s); audio_close(s);
free(s); av_free(s);
return 0; return 0;
} }
......
...@@ -142,6 +142,9 @@ extern AVFormat au_format; ...@@ -142,6 +142,9 @@ extern AVFormat au_format;
/* wav.c */ /* wav.c */
extern AVFormat wav_format; extern AVFormat wav_format;
/* crc.c */
extern AVFormat crc_format;
/* img.c */ /* img.c */
extern AVFormat pgm_format; extern AVFormat pgm_format;
extern AVFormat ppm_format; extern AVFormat ppm_format;
......
...@@ -54,7 +54,7 @@ int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -54,7 +54,7 @@ int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
int i, bps; int i, bps;
AVStream *st; AVStream *st;
avi = malloc(sizeof(AVIContext)); avi = av_malloc(sizeof(AVIContext));
if (!avi) if (!avi)
return -1; return -1;
memset(avi, 0, sizeof(AVIContext)); memset(avi, 0, sizeof(AVIContext));
...@@ -106,7 +106,7 @@ int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -106,7 +106,7 @@ int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
s->nb_streams = get_le32(pb); s->nb_streams = get_le32(pb);
for(i=0;i<s->nb_streams;i++) { for(i=0;i<s->nb_streams;i++) {
AVStream *st; AVStream *st;
st = malloc(sizeof(AVStream)); st = av_malloc(sizeof(AVStream));
if (!st) if (!st)
goto fail; goto fail;
memset(st, 0, sizeof(AVStream)); memset(st, 0, sizeof(AVStream));
...@@ -198,8 +198,7 @@ int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -198,8 +198,7 @@ int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (stream_index != s->nb_streams - 1) { if (stream_index != s->nb_streams - 1) {
fail: fail:
for(i=0;i<s->nb_streams;i++) { for(i=0;i<s->nb_streams;i++) {
if (s->streams[i]) av_freep(&s->streams[i]);
free(s->streams[i]);
} }
return -1; return -1;
} }
...@@ -248,6 +247,6 @@ int avi_read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -248,6 +247,6 @@ int avi_read_packet(AVFormatContext *s, AVPacket *pkt)
int avi_read_close(AVFormatContext *s) int avi_read_close(AVFormatContext *s)
{ {
AVIContext *avi = s->priv_data; AVIContext *avi = s->priv_data;
free(avi); av_free(avi);
return 0; return 0;
} }
...@@ -149,7 +149,7 @@ static int avi_write_header(AVFormatContext *s) ...@@ -149,7 +149,7 @@ static int avi_write_header(AVFormatContext *s)
AVCodecContext *stream, *video_enc; AVCodecContext *stream, *video_enc;
offset_t list1, list2, strh, strf; offset_t list1, list2, strh, strf;
avi = malloc(sizeof(AVIContext)); avi = av_malloc(sizeof(AVIContext));
if (!avi) if (!avi)
return -1; return -1;
memset(avi, 0, sizeof(AVIContext)); memset(avi, 0, sizeof(AVIContext));
...@@ -177,7 +177,7 @@ static int avi_write_header(AVFormatContext *s) ...@@ -177,7 +177,7 @@ static int avi_write_header(AVFormatContext *s)
} }
if (!video_enc) { if (!video_enc) {
free(avi); av_free(avi);
return -1; return -1;
} }
nb_frames = 0; nb_frames = 0;
...@@ -259,7 +259,7 @@ static int avi_write_header(AVFormatContext *s) ...@@ -259,7 +259,7 @@ static int avi_write_header(AVFormatContext *s)
break; break;
case CODEC_TYPE_AUDIO: case CODEC_TYPE_AUDIO:
if (put_wav_header(pb, stream) < 0) { if (put_wav_header(pb, stream) < 0) {
free(avi); av_free(avi);
return -1; return -1;
} }
break; break;
...@@ -309,7 +309,7 @@ static int avi_write_packet(AVFormatContext *s, int stream_index, ...@@ -309,7 +309,7 @@ static int avi_write_packet(AVFormatContext *s, int stream_index,
avi->audio_strm_length[stream_index] += size; avi->audio_strm_length[stream_index] += size;
if (!url_is_streamed(&s->pb)) { if (!url_is_streamed(&s->pb)) {
idx = malloc(sizeof(AVIIndex)); idx = av_malloc(sizeof(AVIIndex));
memcpy(idx->tag, tag, 4); memcpy(idx->tag, tag, 4);
idx->flags = flags; idx->flags = flags;
idx->pos = url_ftell(pb) - avi->movi_list; idx->pos = url_ftell(pb) - avi->movi_list;
...@@ -389,7 +389,7 @@ static int avi_write_trailer(AVFormatContext *s) ...@@ -389,7 +389,7 @@ static int avi_write_trailer(AVFormatContext *s)
} }
put_flush_packet(pb); put_flush_packet(pb);
free(avi); av_free(avi);
return 0; return 0;
} }
......
...@@ -60,7 +60,7 @@ int url_open(URLContext **puc, const char *filename, int flags) ...@@ -60,7 +60,7 @@ int url_open(URLContext **puc, const char *filename, int flags)
} }
return -ENOENT; return -ENOENT;
found: found:
uc = malloc(sizeof(URLContext)); uc = av_malloc(sizeof(URLContext));
if (!uc) if (!uc)
return -ENOMEM; return -ENOMEM;
uc->prot = up; uc->prot = up;
...@@ -69,7 +69,7 @@ int url_open(URLContext **puc, const char *filename, int flags) ...@@ -69,7 +69,7 @@ int url_open(URLContext **puc, const char *filename, int flags)
uc->packet_size = 1; /* default packet size */ uc->packet_size = 1; /* default packet size */
err = up->url_open(uc, filename, flags); err = up->url_open(uc, filename, flags);
if (err < 0) { if (err < 0) {
free(uc); av_free(uc);
*puc = NULL; *puc = NULL;
return err; return err;
} }
...@@ -118,7 +118,7 @@ int url_close(URLContext *h) ...@@ -118,7 +118,7 @@ int url_close(URLContext *h)
int ret; int ret;
ret = h->prot->url_close(h); ret = h->prot->url_close(h);
free(h); av_free(h);
return ret; return ret;
} }
......
...@@ -337,14 +337,14 @@ int url_fdopen(ByteIOContext *s, URLContext *h) ...@@ -337,14 +337,14 @@ int url_fdopen(ByteIOContext *s, URLContext *h)
int buffer_size; int buffer_size;
buffer_size = (IO_BUFFER_SIZE / h->packet_size) * h->packet_size; buffer_size = (IO_BUFFER_SIZE / h->packet_size) * h->packet_size;
buffer = malloc(buffer_size); buffer = av_malloc(buffer_size);
if (!buffer) if (!buffer)
return -ENOMEM; return -ENOMEM;
if (init_put_byte(s, buffer, buffer_size, if (init_put_byte(s, buffer, buffer_size,
(h->flags & URL_WRONLY) != 0, h, (h->flags & URL_WRONLY) != 0, h,
url_read_packet, url_write_packet, url_seek_packet) < 0) { url_read_packet, url_write_packet, url_seek_packet) < 0) {
free(buffer); av_free(buffer);
return -EIO; return -EIO;
} }
s->is_streamed = h->is_streamed; s->is_streamed = h->is_streamed;
...@@ -356,11 +356,11 @@ int url_fdopen(ByteIOContext *s, URLContext *h) ...@@ -356,11 +356,11 @@ int url_fdopen(ByteIOContext *s, URLContext *h)
int url_setbufsize(ByteIOContext *s, int buf_size) int url_setbufsize(ByteIOContext *s, int buf_size)
{ {
UINT8 *buffer; UINT8 *buffer;
buffer = malloc(buf_size); buffer = av_malloc(buf_size);
if (!buffer) if (!buffer)
return -ENOMEM; return -ENOMEM;
free(s->buffer); av_free(s->buffer);
s->buffer = buffer; s->buffer = buffer;
s->buffer_size = buf_size; s->buffer_size = buf_size;
s->buf_ptr = buffer; s->buf_ptr = buffer;
...@@ -391,7 +391,7 @@ int url_fclose(ByteIOContext *s) ...@@ -391,7 +391,7 @@ int url_fclose(ByteIOContext *s)
{ {
URLContext *h = s->opaque; URLContext *h = s->opaque;
free(s->buffer); av_free(s->buffer);
memset(s, 0, sizeof(ByteIOContext)); memset(s, 0, sizeof(ByteIOContext));
return url_close(h); return url_close(h);
} }
......
...@@ -93,6 +93,7 @@ static int crc_write_trailer(struct AVFormatContext *s) ...@@ -93,6 +93,7 @@ static int crc_write_trailer(struct AVFormatContext *s)
snprintf(buf, sizeof(buf), "CRC=%08x\n", crc->crcval); snprintf(buf, sizeof(buf), "CRC=%08x\n", crc->crcval);
put_buffer(&s->pb, buf, strlen(buf)); put_buffer(&s->pb, buf, strlen(buf));
put_flush_packet(&s->pb); put_flush_packet(&s->pb);
av_free(crc);
return 0; return 0;
} }
......
...@@ -198,10 +198,9 @@ static int ffm_write_header(AVFormatContext *s) ...@@ -198,10 +198,9 @@ static int ffm_write_header(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];
fst = st->priv_data; fst = st->priv_data;
if (fst) av_free(fst);
free(fst);
} }
free(ffm); av_free(ffm);
return -1; return -1;
} }
...@@ -252,8 +251,8 @@ static int ffm_write_trailer(AVFormatContext *s) ...@@ -252,8 +251,8 @@ 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++)
free(s->streams[i]->priv_data); av_free(s->streams[i]->priv_data);
free(ffm); av_free(ffm);
return 0; return 0;
} }
...@@ -433,13 +432,12 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -433,13 +432,12 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
st = s->streams[i]; st = s->streams[i];
if (st) { if (st) {
fst = st->priv_data; fst = st->priv_data;
if (fst) av_free(fst);
free(fst); av_free(st);
free(st);
} }
} }
if (ffm) if (ffm)
free(ffm); av_free(ffm);
return -1; return -1;
} }
...@@ -615,9 +613,9 @@ static int ffm_read_close(AVFormatContext *s) ...@@ -615,9 +613,9 @@ 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];
free(st->priv_data); av_free(st->priv_data);
} }
free(s->priv_data); av_free(s->priv_data);
return 0; return 0;
} }
......
...@@ -202,7 +202,7 @@ static int gif_write_header(AVFormatContext *s) ...@@ -202,7 +202,7 @@ static int gif_write_header(AVFormatContext *s)
return -1; return -1;
*/ */
gif = malloc(sizeof(GIFContext)); gif = av_malloc(sizeof(GIFContext));
if (!gif) if (!gif)
return -1; return -1;
s->priv_data = gif; s->priv_data = gif;
...@@ -218,7 +218,7 @@ static int gif_write_header(AVFormatContext *s) ...@@ -218,7 +218,7 @@ static int gif_write_header(AVFormatContext *s)
} }
if (!video_enc) { if (!video_enc) {
free(gif); av_free(gif);
return -1; return -1;
} else { } else {
width = video_enc->width; width = video_enc->width;
...@@ -382,7 +382,7 @@ static int gif_write_trailer(AVFormatContext *s) ...@@ -382,7 +382,7 @@ static int gif_write_trailer(AVFormatContext *s)
put_byte(pb, 0x3b); put_byte(pb, 0x3b);
put_flush_packet(&s->pb); put_flush_packet(&s->pb);
free(gif); av_free(gif);
return 0; return 0;
} }
......
...@@ -67,7 +67,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap) ...@@ -67,7 +67,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
return -ENOMEM; return -ENOMEM;
st = av_mallocz(sizeof(AVStream)); st = av_mallocz(sizeof(AVStream));
if (!st) { if (!st) {
free(s); av_free(s);
return -ENOMEM; return -ENOMEM;
} }
s1->priv_data = s; s1->priv_data = s;
...@@ -231,8 +231,8 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap) ...@@ -231,8 +231,8 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
fail: fail:
if (video_fd >= 0) if (video_fd >= 0)
close(video_fd); close(video_fd);
free(st); av_free(st);
free(s); av_free(s);
return -EIO; return -EIO;
} }
...@@ -327,7 +327,7 @@ static int grab_read_close(AVFormatContext *s1) ...@@ -327,7 +327,7 @@ static int grab_read_close(AVFormatContext *s1)
ioctl(s->fd, VIDIOCSAUDIO, &audio_saved); ioctl(s->fd, VIDIOCSAUDIO, &audio_saved);
close(s->fd); close(s->fd);
free(s); av_free(s);
return 0; return 0;
} }
......
...@@ -58,7 +58,7 @@ static int http_open(URLContext *h, const char *uri, int flags) ...@@ -58,7 +58,7 @@ static int http_open(URLContext *h, const char *uri, int flags)
h->is_streamed = 1; h->is_streamed = 1;
s = malloc(sizeof(HTTPContext)); s = av_malloc(sizeof(HTTPContext));
if (!s) { if (!s) {
return -ENOMEM; return -ENOMEM;
} }
...@@ -129,7 +129,7 @@ static int http_open(URLContext *h, const char *uri, int flags) ...@@ -129,7 +129,7 @@ static int http_open(URLContext *h, const char *uri, int flags)
fail: fail:
if (fd >= 0) if (fd >= 0)
close(fd); close(fd);
free(s); av_free(s);
return -EIO; return -EIO;
} }
......
...@@ -255,7 +255,7 @@ static int img_read_header(AVFormatContext *s1, AVFormatParameters *ap) ...@@ -255,7 +255,7 @@ static int img_read_header(AVFormatContext *s1, AVFormatParameters *ap)
ByteIOContext pb1, *f = &pb1; ByteIOContext pb1, *f = &pb1;
AVStream *st; AVStream *st;
s = malloc(sizeof(VideoData)); s = av_malloc(sizeof(VideoData));
if (!s) if (!s)
return -ENOMEM; return -ENOMEM;
...@@ -264,7 +264,7 @@ static int img_read_header(AVFormatContext *s1, AVFormatParameters *ap) ...@@ -264,7 +264,7 @@ static int img_read_header(AVFormatContext *s1, AVFormatParameters *ap)
s1->nb_streams = 1; s1->nb_streams = 1;
st = av_mallocz(sizeof(AVStream)); st = av_mallocz(sizeof(AVStream));
if (!st) { if (!st) {
free(s); av_free(s);
return -ENOMEM; return -ENOMEM;
} }
s1->streams[0] = st; s1->streams[0] = st;
...@@ -372,14 +372,14 @@ static int img_read_header(AVFormatContext *s1, AVFormatParameters *ap) ...@@ -372,14 +372,14 @@ static int img_read_header(AVFormatContext *s1, AVFormatParameters *ap)
if (!s->is_pipe) if (!s->is_pipe)
url_fclose(f); url_fclose(f);
fail: fail:
free(s); av_free(s);
return -EIO; return -EIO;
} }
static int img_read_close(AVFormatContext *s1) static int img_read_close(AVFormatContext *s1)
{ {
VideoData *s = s1->priv_data; VideoData *s = s1->priv_data;
free(s); av_free(s);
return 0; return 0;
} }
...@@ -510,7 +510,7 @@ static int img_write_header(AVFormatContext *s) ...@@ -510,7 +510,7 @@ static int img_write_header(AVFormatContext *s)
} }
return 0; return 0;
fail: fail:
free(img); av_free(img);
return -EIO; return -EIO;
} }
...@@ -591,7 +591,7 @@ static int img_write_packet(AVFormatContext *s, int stream_index, ...@@ -591,7 +591,7 @@ static int img_write_packet(AVFormatContext *s, int stream_index,
static int img_write_trailer(AVFormatContext *s) static int img_write_trailer(AVFormatContext *s)
{ {
VideoData *img = s->priv_data; VideoData *img = s->priv_data;
free(img); av_free(img);
return 0; return 0;
} }
......
...@@ -144,7 +144,7 @@ static int jpeg_write_packet(AVFormatContext *s1, int stream_index, ...@@ -144,7 +144,7 @@ static int jpeg_write_packet(AVFormatContext *s1, int stream_index,
static int jpeg_write_trailer(AVFormatContext *s1) static int jpeg_write_trailer(AVFormatContext *s1)
{ {
JpegContext *s = s1->priv_data; JpegContext *s = s1->priv_data;
free(s); av_free(s);
return 0; return 0;
} }
...@@ -167,7 +167,7 @@ static int jpeg_read_header(AVFormatContext *s1, AVFormatParameters *ap) ...@@ -167,7 +167,7 @@ static int jpeg_read_header(AVFormatContext *s1, AVFormatParameters *ap)
s1->nb_streams = 1; s1->nb_streams = 1;
st = av_mallocz(sizeof(AVStream)); st = av_mallocz(sizeof(AVStream));
if (!st) { if (!st) {
free(s); av_free(s);
return -ENOMEM; return -ENOMEM;
} }
s1->streams[0] = st; s1->streams[0] = st;
...@@ -193,7 +193,7 @@ static int jpeg_read_header(AVFormatContext *s1, AVFormatParameters *ap) ...@@ -193,7 +193,7 @@ static int jpeg_read_header(AVFormatContext *s1, AVFormatParameters *ap)
st->codec.frame_rate = ap->frame_rate; st->codec.frame_rate = ap->frame_rate;
return 0; return 0;
fail: fail:
free(s); av_free(s);
return -EIO; return -EIO;
} }
...@@ -227,7 +227,7 @@ static int jpeg_read_packet(AVFormatContext *s1, AVPacket *pkt) ...@@ -227,7 +227,7 @@ static int jpeg_read_packet(AVFormatContext *s1, AVPacket *pkt)
static int jpeg_read_close(AVFormatContext *s1) static int jpeg_read_close(AVFormatContext *s1)
{ {
JpegContext *s = s1->priv_data; JpegContext *s = s1->priv_data;
free(s); av_free(s);
return 0; return 0;
} }
......
# Microsoft Developer Studio Project File - Name="libav" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=libav - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "libav.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "libav.mak" CFG="libav - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "libav - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "libav - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "libav - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../Release/libav"
# PROP Intermediate_Dir "../Release/libav"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../libavcodec" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x40c /d "NDEBUG"
# ADD RSC /l 0x40c /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "libav - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "../Debug/libav"
# PROP Intermediate_Dir "../Debug/libav"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../libavcodec" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD BASE RSC /l 0x40c /d "_DEBUG"
# ADD RSC /l 0x40c /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# SUBTRACT LIB32 /nologo
!ENDIF
# Begin Target
# Name "libav - Win32 Release"
# Name "libav - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\asf.c
# End Source File
# Begin Source File
SOURCE=.\avformat.h
# End Source File
# Begin Source File
SOURCE=.\avi.h
# End Source File
# Begin Source File
SOURCE=.\avidec.c
# End Source File
# Begin Source File
SOURCE=.\avienc.c
# End Source File
# Begin Source File
SOURCE=.\avio.c
# End Source File
# Begin Source File
SOURCE=.\avio.h
# End Source File
# Begin Source File
SOURCE=.\aviobuf.c
# End Source File
# Begin Source File
SOURCE=.\file.c
# End Source File
# Begin Source File
SOURCE=.\img.c
# End Source File
# Begin Source File
SOURCE=.\jpegenc.c
# End Source File
# Begin Source File
SOURCE=.\mpeg.c
# End Source File
# Begin Source File
SOURCE=.\raw.c
# End Source File
# Begin Source File
SOURCE=.\rm.c
# End Source File
# Begin Source File
SOURCE=.\swf.c
# End Source File
# Begin Source File
SOURCE=.\utils.c
# End Source File
# Begin Source File
SOURCE=.\wav.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# End Target
# End Project
...@@ -335,11 +335,11 @@ static int parse_trak(const MOVParseTableEntry *parse_table, ByteIOContext *pb, ...@@ -335,11 +335,11 @@ static int parse_trak(const MOVParseTableEntry *parse_table, ByteIOContext *pb,
#endif #endif
c = (MOVContext *)param; c = (MOVContext *)param;
st = malloc(sizeof(AVStream)); st = av_malloc(sizeof(AVStream));
if (!st) return -2; if (!st) return -2;
memset(st, 0, sizeof(AVStream)); memset(st, 0, sizeof(AVStream));
c->fc->streams[c->fc->nb_streams] = st; c->fc->streams[c->fc->nb_streams] = st;
sc = malloc(sizeof(MOVStreamContext)); sc = av_malloc(sizeof(MOVStreamContext));
st->priv_data = sc; st->priv_data = sc;
st->codec.codec_type = CODEC_TYPE_MOV_OTHER; st->codec.codec_type = CODEC_TYPE_MOV_OTHER;
c->streams[c->fc->nb_streams++] = sc; c->streams[c->fc->nb_streams++] = sc;
...@@ -461,13 +461,13 @@ static int parse_hdlr(const MOVParseTableEntry *parse_table, ByteIOContext *pb, ...@@ -461,13 +461,13 @@ static int parse_hdlr(const MOVParseTableEntry *parse_table, ByteIOContext *pb,
} else { } else {
len = get_byte(pb); len = get_byte(pb);
if(len) { if(len) {
buf = malloc(len+1); buf = av_malloc(len+1);
get_buffer(pb, buf, len); get_buffer(pb, buf, len);
buf[len] = '\0'; buf[len] = '\0';
#ifdef DEBUG #ifdef DEBUG
puts(buf); puts(buf);
#endif #endif
free(buf); av_free(buf);
} }
} }
...@@ -578,11 +578,11 @@ static int parse_stsd(const MOVParseTableEntry *parse_table, ByteIOContext *pb, ...@@ -578,11 +578,11 @@ static int parse_stsd(const MOVParseTableEntry *parse_table, ByteIOContext *pb,
} }
/* /*
if(len) { if(len) {
buf = malloc(len+1); buf = av_malloc(len+1);
get_buffer(pb, buf, len); get_buffer(pb, buf, len);
buf[len] = '\0'; buf[len] = '\0';
puts(buf); puts(buf);
free(buf); av_free(buf);
} }
*/ */
return 0; return 0;
...@@ -606,7 +606,7 @@ static int parse_stco(const MOVParseTableEntry *parse_table, ByteIOContext *pb, ...@@ -606,7 +606,7 @@ static int parse_stco(const MOVParseTableEntry *parse_table, ByteIOContext *pb,
entries = get_be32(pb); entries = get_be32(pb);
sc->chunk_count = entries; sc->chunk_count = entries;
sc->chunk_offsets = malloc(entries * sizeof(INT64)); sc->chunk_offsets = av_malloc(entries * sizeof(INT64));
if(atom_type == MKTAG('s', 't', 'c', 'o')) { if(atom_type == MKTAG('s', 't', 'c', 'o')) {
for(i=0; i<entries; i++) { for(i=0; i<entries; i++) {
sc->chunk_offsets[i] = get_be32(pb); sc->chunk_offsets[i] = get_be32(pb);
...@@ -640,7 +640,7 @@ static int parse_stsc(const MOVParseTableEntry *parse_table, ByteIOContext *pb, ...@@ -640,7 +640,7 @@ static int parse_stsc(const MOVParseTableEntry *parse_table, ByteIOContext *pb,
entries = get_be32(pb); entries = get_be32(pb);
sc->sample_to_chunk_sz = entries; sc->sample_to_chunk_sz = entries;
sc->sample_to_chunk = malloc(entries * sizeof(MOV_sample_to_chunk_tbl)); sc->sample_to_chunk = av_malloc(entries * sizeof(MOV_sample_to_chunk_tbl));
for(i=0; i<entries; i++) { for(i=0; i<entries; i++) {
sc->sample_to_chunk[i].first = get_be32(pb); sc->sample_to_chunk[i].first = get_be32(pb);
sc->sample_to_chunk[i].count = get_be32(pb); sc->sample_to_chunk[i].count = get_be32(pb);
...@@ -674,7 +674,7 @@ static int parse_stsz(const MOVParseTableEntry *parse_table, ByteIOContext *pb, ...@@ -674,7 +674,7 @@ static int parse_stsz(const MOVParseTableEntry *parse_table, ByteIOContext *pb,
printf("sample_size = %ld sample_count = %ld\n", sc->sample_size, sc->sample_count); printf("sample_size = %ld sample_count = %ld\n", sc->sample_size, sc->sample_count);
if(sc->sample_size) if(sc->sample_size)
return 0; /* there isn't any table following */ return 0; /* there isn't any table following */
sc->sample_sizes = malloc(entries * sizeof(long)); sc->sample_sizes = av_malloc(entries * sizeof(long));
for(i=0; i<entries; i++) { for(i=0; i<entries; i++) {
sc->sample_sizes[i] = get_be32(pb); sc->sample_sizes[i] = get_be32(pb);
#ifdef DEBUG #ifdef DEBUG
...@@ -757,11 +757,9 @@ static const MOVParseTableEntry mov_default_parse_table[] = { ...@@ -757,11 +757,9 @@ static const MOVParseTableEntry mov_default_parse_table[] = {
static void mov_free_stream_context(MOVStreamContext *sc) static void mov_free_stream_context(MOVStreamContext *sc)
{ {
if(sc) { if(sc) {
if(sc->chunk_offsets) av_free(sc->chunk_offsets);
free(sc->chunk_offsets); av_free(sc->sample_to_chunk);
if(sc->sample_to_chunk) av_free(sc);
free(sc->sample_to_chunk);
free(sc);
} }
} }
...@@ -772,10 +770,9 @@ static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -772,10 +770,9 @@ static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap)
int i, j, nb, err; int i, j, nb, err;
INT64 size; INT64 size;
mov = malloc(sizeof(MOVContext)); mov = av_mallocz(sizeof(MOVContext));
if (!mov) if (!mov)
return -1; return -1;
memset(mov, 0, sizeof(MOVContext));
s->priv_data = mov; s->priv_data = mov;
mov->fc = s; mov->fc = s;
...@@ -817,7 +814,7 @@ static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -817,7 +814,7 @@ static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap)
#if 1 #if 1
for(i=0; i<s->nb_streams;) { for(i=0; i<s->nb_streams;) {
if(s->streams[i]->codec.codec_type == CODEC_TYPE_MOV_OTHER) {/* not audio, not video, delete */ if(s->streams[i]->codec.codec_type == CODEC_TYPE_MOV_OTHER) {/* not audio, not video, delete */
free(s->streams[i]); av_free(s->streams[i]);
for(j=i+1; j<s->nb_streams; j++) for(j=i+1; j<s->nb_streams; j++)
s->streams[j-1] = s->streams[j]; s->streams[j-1] = s->streams[j];
s->nb_streams--; s->nb_streams--;
...@@ -918,8 +915,8 @@ static int mov_read_close(AVFormatContext *s) ...@@ -918,8 +915,8 @@ static int mov_read_close(AVFormatContext *s)
for(i=0; i<mov->total_streams; i++) for(i=0; i<mov->total_streams; i++)
mov_free_stream_context(mov->streams[i]); mov_free_stream_context(mov->streams[i]);
for(i=0; i<s->nb_streams; i++) for(i=0; i<s->nb_streams; i++)
free(s->streams[i]); av_free(s->streams[i]);
free(mov); av_free(mov);
return 0; return 0;
} }
......
...@@ -155,10 +155,9 @@ static int mpeg_mux_init(AVFormatContext *ctx) ...@@ -155,10 +155,9 @@ static int mpeg_mux_init(AVFormatContext *ctx)
AVStream *st; AVStream *st;
StreamInfo *stream; StreamInfo *stream;
s = malloc(sizeof(MpegMuxContext)); s = av_mallocz(sizeof(MpegMuxContext));
if (!s) if (!s)
return -1; return -1;
memset(s, 0, sizeof(MpegMuxContext));
ctx->priv_data = s; ctx->priv_data = s;
s->packet_number = 0; s->packet_number = 0;
...@@ -251,9 +250,9 @@ static int mpeg_mux_init(AVFormatContext *ctx) ...@@ -251,9 +250,9 @@ static int mpeg_mux_init(AVFormatContext *ctx)
return 0; return 0;
fail: fail:
for(i=0;i<ctx->nb_streams;i++) { for(i=0;i<ctx->nb_streams;i++) {
free(ctx->streams[i]->priv_data); av_free(ctx->streams[i]->priv_data);
} }
free(s); av_free(s);
return -ENOMEM; return -ENOMEM;
} }
...@@ -873,7 +872,7 @@ static int mpeg_mux_check_packet(AVFormatContext *s, int *size) ...@@ -873,7 +872,7 @@ static int mpeg_mux_check_packet(AVFormatContext *s, int *size)
static int mpeg_mux_read_close(AVFormatContext *s) static int mpeg_mux_read_close(AVFormatContext *s)
{ {
MpegDemuxContext *m = s->priv_data; MpegDemuxContext *m = s->priv_data;
free(m); av_free(m);
return 0; return 0;
} }
......
...@@ -286,7 +286,7 @@ static int rm_write_header(AVFormatContext *s) ...@@ -286,7 +286,7 @@ static int rm_write_header(AVFormatContext *s)
int n; int n;
AVCodecContext *codec; AVCodecContext *codec;
rm = malloc(sizeof(RMContext)); rm = av_malloc(sizeof(RMContext));
if (!rm) if (!rm)
return -1; return -1;
memset(rm, 0, sizeof(RMContext)); memset(rm, 0, sizeof(RMContext));
...@@ -337,7 +337,7 @@ static int rm_write_audio(AVFormatContext *s, UINT8 *buf, int size) ...@@ -337,7 +337,7 @@ static int rm_write_audio(AVFormatContext *s, UINT8 *buf, int size)
int i; int i;
/* XXX: suppress this malloc */ /* XXX: suppress this malloc */
buf1= (UINT8*) malloc( size * sizeof(UINT8) ); buf1= (UINT8*) av_malloc( size * sizeof(UINT8) );
write_packet_header(s, stream, size, stream->enc->key_frame); write_packet_header(s, stream, size, stream->enc->key_frame);
...@@ -349,7 +349,7 @@ static int rm_write_audio(AVFormatContext *s, UINT8 *buf, int size) ...@@ -349,7 +349,7 @@ static int rm_write_audio(AVFormatContext *s, UINT8 *buf, int size)
put_buffer(pb, buf1, size); put_buffer(pb, buf1, size);
put_flush_packet(pb); put_flush_packet(pb);
stream->nb_frames++; stream->nb_frames++;
free(buf1); av_free(buf1);
return 0; return 0;
} }
...@@ -439,7 +439,7 @@ static int rm_write_trailer(AVFormatContext *s) ...@@ -439,7 +439,7 @@ static int rm_write_trailer(AVFormatContext *s)
} }
put_flush_packet(pb); put_flush_packet(pb);
free(rm); av_free(rm);
return 0; return 0;
} }
...@@ -638,7 +638,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -638,7 +638,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
fail: fail:
for(i=0;i<s->nb_streams;i++) { for(i=0;i<s->nb_streams;i++) {
free(s->streams[i]); av_free(s->streams[i]);
} }
return -EIO; return -EIO;
} }
...@@ -707,7 +707,7 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -707,7 +707,7 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
static int rm_read_close(AVFormatContext *s) static int rm_read_close(AVFormatContext *s)
{ {
RMContext *rm = s->priv_data; RMContext *rm = s->priv_data;
free(rm); av_free(rm);
return 0; return 0;
} }
......
...@@ -196,7 +196,7 @@ static int swf_write_header(AVFormatContext *s) ...@@ -196,7 +196,7 @@ static int swf_write_header(AVFormatContext *s)
UINT8 buf1[256]; UINT8 buf1[256];
int i, width, height, rate; int i, width, height, rate;
swf = malloc(sizeof(SWFContext)); swf = av_malloc(sizeof(SWFContext));
if (!swf) if (!swf)
return -1; return -1;
s->priv_data = swf; s->priv_data = swf;
...@@ -294,7 +294,7 @@ static int swf_write_header(AVFormatContext *s) ...@@ -294,7 +294,7 @@ static int swf_write_header(AVFormatContext *s)
break; break;
default: default:
/* not supported */ /* not supported */
free(swf); av_free(swf);
return -1; return -1;
} }
if (audio_enc->channels == 2) if (audio_enc->channels == 2)
...@@ -414,7 +414,7 @@ static int swf_write_trailer(AVFormatContext *s) ...@@ -414,7 +414,7 @@ static int swf_write_trailer(AVFormatContext *s)
url_fseek(pb, swf->duration_pos, SEEK_SET); url_fseek(pb, swf->duration_pos, SEEK_SET);
put_le16(pb, video_enc->frame_number); put_le16(pb, video_enc->frame_number);
} }
free(swf); av_free(swf);
return 0; return 0;
} }
...@@ -488,7 +488,7 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -488,7 +488,7 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec.sample_rate = 44100; st->codec.sample_rate = 44100;
break; break;
default: default:
free(st); av_free(st);
return -EIO; return -EIO;
} }
st->codec.codec_type = CODEC_TYPE_AUDIO; st->codec.codec_type = CODEC_TYPE_AUDIO;
......
...@@ -92,7 +92,7 @@ static int udp_open(URLContext *h, const char *uri, int flags) ...@@ -92,7 +92,7 @@ static int udp_open(URLContext *h, const char *uri, int flags)
goto fail; goto fail;
} }
s = malloc(sizeof(UDPContext)); s = av_malloc(sizeof(UDPContext));
if (!s) if (!s)
return -ENOMEM; return -ENOMEM;
h->priv_data = s; h->priv_data = s;
......
...@@ -159,6 +159,8 @@ void register_all(void) ...@@ -159,6 +159,8 @@ void register_all(void)
register_avformat(&gif_format); register_avformat(&gif_format);
register_avformat(&au_format); register_avformat(&au_format);
register_avformat(&wav_format); register_avformat(&wav_format);
register_avformat(&crc_format);
register_avformat(&pcm_s16le_format); register_avformat(&pcm_s16le_format);
register_avformat(&pcm_s16be_format); register_avformat(&pcm_s16be_format);
register_avformat(&pcm_u16le_format); register_avformat(&pcm_u16le_format);
...@@ -196,7 +198,7 @@ void register_all(void) ...@@ -196,7 +198,7 @@ void register_all(void)
int av_new_packet(AVPacket *pkt, int size) int av_new_packet(AVPacket *pkt, int size)
{ {
pkt->data = malloc(size); pkt->data = av_malloc(size);
if (!pkt->data) if (!pkt->data)
return -ENOMEM; return -ENOMEM;
pkt->size = size; pkt->size = size;
...@@ -209,9 +211,8 @@ int av_new_packet(AVPacket *pkt, int size) ...@@ -209,9 +211,8 @@ int av_new_packet(AVPacket *pkt, int size)
void av_free_packet(AVPacket *pkt) void av_free_packet(AVPacket *pkt)
{ {
free(pkt->data); av_freep(&pkt->data);
/* fail safe */ /* fail safe */
pkt->data = NULL;
pkt->size = 0; pkt->size = 0;
} }
...@@ -219,7 +220,7 @@ void av_free_packet(AVPacket *pkt) ...@@ -219,7 +220,7 @@ void av_free_packet(AVPacket *pkt)
int fifo_init(FifoBuffer *f, int size) int fifo_init(FifoBuffer *f, int size)
{ {
f->buffer = malloc(size); f->buffer = av_malloc(size);
if (!f->buffer) if (!f->buffer)
return -1; return -1;
f->end = f->buffer + size; f->end = f->buffer + size;
...@@ -229,7 +230,7 @@ int fifo_init(FifoBuffer *f, int size) ...@@ -229,7 +230,7 @@ int fifo_init(FifoBuffer *f, int size)
void fifo_free(FifoBuffer *f) void fifo_free(FifoBuffer *f)
{ {
free(f->buffer); av_free(f->buffer);
} }
int fifo_size(FifoBuffer *f, UINT8 *rptr) int fifo_size(FifoBuffer *f, UINT8 *rptr)
...@@ -343,8 +344,7 @@ AVFormatContext *av_open_input_file(const char *filename, ...@@ -343,8 +344,7 @@ AVFormatContext *av_open_input_file(const char *filename,
return ic; return ic;
fail: fail:
if (ic) av_free(ic);
free(ic);
return NULL; return NULL;
} }
...@@ -357,7 +357,7 @@ int av_read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -357,7 +357,7 @@ int av_read_packet(AVFormatContext *s, AVPacket *pkt)
/* read packet from packet buffer, if there is data */ /* read packet from packet buffer, if there is data */
*pkt = pktl->pkt; *pkt = pktl->pkt;
s->packet_buffer = pktl->next; s->packet_buffer = pktl->next;
free(pktl); av_free(pktl);
return 0; return 0;
} else { } else {
return s->format->read_packet(s, pkt); return s->format->read_packet(s, pkt);
...@@ -371,7 +371,7 @@ void av_close_input_file(AVFormatContext *s) ...@@ -371,7 +371,7 @@ void av_close_input_file(AVFormatContext *s)
if (s->format->read_close) if (s->format->read_close)
s->format->read_close(s); s->format->read_close(s);
for(i=0;i<s->nb_streams;i++) { for(i=0;i<s->nb_streams;i++) {
free(s->streams[i]); av_free(s->streams[i]);
} }
if (s->packet_buffer) { if (s->packet_buffer) {
AVPacketList *p, *p1; AVPacketList *p, *p1;
...@@ -379,7 +379,7 @@ void av_close_input_file(AVFormatContext *s) ...@@ -379,7 +379,7 @@ void av_close_input_file(AVFormatContext *s)
while (p != NULL) { while (p != NULL) {
p1 = p->next; p1 = p->next;
av_free_packet(&p->pkt); av_free_packet(&p->pkt);
free(p); av_free(p);
p = p1; p = p1;
} }
s->packet_buffer = NULL; s->packet_buffer = NULL;
...@@ -387,7 +387,7 @@ void av_close_input_file(AVFormatContext *s) ...@@ -387,7 +387,7 @@ void av_close_input_file(AVFormatContext *s)
if (!(s->format->flags & AVFMT_NOFILE)) { if (!(s->format->flags & AVFMT_NOFILE)) {
url_fclose(&s->pb); url_fclose(&s->pb);
} }
free(s); av_free(s);
} }
......
...@@ -114,7 +114,7 @@ static int wav_write_header(AVFormatContext *s) ...@@ -114,7 +114,7 @@ static int wav_write_header(AVFormatContext *s)
ByteIOContext *pb = &s->pb; ByteIOContext *pb = &s->pb;
offset_t fmt; offset_t fmt;
wav = malloc(sizeof(WAVContext)); wav = av_malloc(sizeof(WAVContext));
if (!wav) if (!wav)
return -1; return -1;
memset(wav, 0, sizeof(WAVContext)); memset(wav, 0, sizeof(WAVContext));
...@@ -127,7 +127,7 @@ static int wav_write_header(AVFormatContext *s) ...@@ -127,7 +127,7 @@ static int wav_write_header(AVFormatContext *s)
/* format header */ /* format header */
fmt = start_tag(pb, "fmt "); fmt = start_tag(pb, "fmt ");
if (put_wav_header(pb, &s->streams[0]->codec) < 0) { if (put_wav_header(pb, &s->streams[0]->codec) < 0) {
free(wav); av_free(wav);
return -1; return -1;
} }
end_tag(pb, fmt); end_tag(pb, fmt);
...@@ -166,7 +166,7 @@ static int wav_write_trailer(AVFormatContext *s) ...@@ -166,7 +166,7 @@ static int wav_write_trailer(AVFormatContext *s)
put_flush_packet(pb); put_flush_packet(pb);
} }
free(wav); av_free(wav);
return 0; return 0;
} }
...@@ -233,7 +233,7 @@ static int wav_read_header(AVFormatContext *s, ...@@ -233,7 +233,7 @@ static int wav_read_header(AVFormatContext *s,
return -1; return -1;
/* now we are ready: build format streams */ /* now we are ready: build format streams */
st = malloc(sizeof(AVStream)); st = av_malloc(sizeof(AVStream));
if (!st) if (!st)
return -1; return -1;
s->nb_streams = 1; s->nb_streams = 1;
......
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