diff options
author | Juanjo <pulento@users.sourceforge.net> | 2002-04-02 15:07:01 +0000 |
---|---|---|
committer | Juanjo <pulento@users.sourceforge.net> | 2002-04-02 15:07:01 +0000 |
commit | 5b0ad91b996506632708dcefc22d2835d04a4dba (patch) | |
tree | 58f1409b7207a5d235db0ea52bb5b65ccce2774a /ffmpeg.c | |
parent | c60cf138bd82cf80a2b239cf5f48fbf9ff0a125c (diff) | |
download | ffmpeg-5b0ad91b996506632708dcefc22d2835d04a4dba.tar.gz |
- Fix memory leak and others bugs for ppmpipe. Thanks to Rudolf Opalla.
Originally committed as revision 373 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffmpeg.c')
-rw-r--r-- | ffmpeg.c | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -302,15 +302,14 @@ static void write_picture(AVFormatContext *s, int index, AVPicture *picture, UINT8 *buf, *src, *dest; int size, j, i; - size = avpicture_get_size(pix_fmt, w, h); - buf = malloc(size); - if (!buf) - return; - /* XXX: not efficient, should add test if we can take directly the AVPicture */ switch(pix_fmt) { case PIX_FMT_YUV420P: + size = avpicture_get_size(pix_fmt, w, h); + buf = malloc(size); + if (!buf) + return; dest = buf; for(i=0;i<3;i++) { if (i == 1) { @@ -328,6 +327,8 @@ static void write_picture(AVFormatContext *s, int index, AVPicture *picture, case PIX_FMT_YUV422P: size = (w * h) * 2; buf = malloc(size); + if (!buf) + return; dest = buf; for(i=0;i<3;i++) { if (i == 1) { @@ -344,6 +345,8 @@ static void write_picture(AVFormatContext *s, int index, AVPicture *picture, case PIX_FMT_YUV444P: size = (w * h) * 3; buf = malloc(size); + if (!buf) + return; dest = buf; for(i=0;i<3;i++) { src = picture->data[i]; @@ -357,6 +360,8 @@ static void write_picture(AVFormatContext *s, int index, AVPicture *picture, case PIX_FMT_YUV422: size = (w * h) * 2; buf = malloc(size); + if (!buf) + return; dest = buf; src = picture->data[0]; for(j=0;j<h;j++) { @@ -369,6 +374,8 @@ static void write_picture(AVFormatContext *s, int index, AVPicture *picture, case PIX_FMT_BGR24: size = (w * h) * 3; buf = malloc(size); + if (!buf) + return; dest = buf; src = picture->data[0]; for(j=0;j<h;j++) { |