[MPlayer-cvslog] r37633 - trunk/gui/util/bitmap.c

ib subversion at mplayerhq.hu
Tue Feb 9 12:17:16 CET 2016


Author: ib
Date: Tue Feb  9 12:17:16 2016
New Revision: 37633

Log:
Check return value.

Additionally, upgrade documentation.

Modified:
   trunk/gui/util/bitmap.c

Modified: trunk/gui/util/bitmap.c
==============================================================================
--- trunk/gui/util/bitmap.c	Mon Feb  8 23:11:49 2016	(r37632)
+++ trunk/gui/util/bitmap.c	Tue Feb  9 12:17:16 2016	(r37633)
@@ -68,8 +68,9 @@ static const char *fExist(const char *fn
  * @param fname filename (with path)
  * @param img memory location to store the image data
  *
- * @return 0 (ok), 1 (decoding error), 2 (open error), 3 (file too big),
- *                 4 (out of memory), 5 (read error), 6 (avcodec alloc error)
+ * @return 0 (ok), 1 (decoding error), 2 (file open error), 3 (file too big),
+ *                 4 (out of memory), 5 (read error), 6 (avcodec alloc error),
+ *                 7 (avcodec open error)
  */
 static int pngRead(const char *fname, guiImage *img)
 {
@@ -121,7 +122,13 @@ static int pngRead(const char *fname, gu
     }
 
     avcodec_register_all();
-    avcodec_open2(avctx, avcodec_find_decoder(AV_CODEC_ID_PNG), NULL);
+
+    if (avcodec_open2(avctx, avcodec_find_decoder(AV_CODEC_ID_PNG), NULL) != 0) {
+        av_free(frame);
+        av_free(avctx);
+        av_free(data);
+        return 7;
+    }
 
     av_init_packet(&pkt);
     pkt.data = data;


More information about the MPlayer-cvslog mailing list