OSDN Git Service

Make avpicture_alloc() return meaningful values.
authorStefano Sabatini <stefano.sabatini-lala@poste.it>
Wed, 8 Dec 2010 10:24:09 +0000 (10:24 +0000)
committerStefano Sabatini <stefano.sabatini-lala@poste.it>
Wed, 8 Dec 2010 10:24:09 +0000 (10:24 +0000)
Originally committed as revision 25922 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/imgconvert.c

index 165ba9e..3c14361 100644 (file)
@@ -813,9 +813,11 @@ void ff_shrink88(uint8_t *dst, int dst_wrap,
 int avpicture_alloc(AVPicture *picture,
                     enum PixelFormat pix_fmt, int width, int height)
 {
-    if (av_image_alloc(picture->data, picture->linesize, width, height, pix_fmt, 0) < 0) {
+    int ret;
+
+    if ((ret = av_image_alloc(picture->data, picture->linesize, width, height, pix_fmt, 0)) < 0) {
         memset(picture, 0, sizeof(AVPicture));
-        return -1;
+        return ret;
     }
 
     return 0;