[FFmpeg-soc] [soc]: r5241 - in concat/libavformat: avplaylist.c avplaylist.h

gkovacs subversion at mplayerhq.hu
Mon Aug 24 08:24:15 CEST 2009


Author: gkovacs
Date: Mon Aug 24 08:24:15 2009
New Revision: 5241

Log:
clean up after failure in av_playlist_alloc_formatcontext

Modified:
   concat/libavformat/avplaylist.c
   concat/libavformat/avplaylist.h

Modified: concat/libavformat/avplaylist.c
==============================================================================
--- concat/libavformat/avplaylist.c	Mon Aug 24 08:00:51 2009	(r5240)
+++ concat/libavformat/avplaylist.c	Mon Aug 24 08:24:15 2009	(r5241)
@@ -43,11 +43,17 @@ AVFormatContext *av_playlist_alloc_forma
     int err;
     AVFormatContext *ic = avformat_alloc_context();
     err = av_open_input_file(&ic, filename, ic->iformat, 0, NULL);
-    if (err < 0)
+    if (err < 0) {
         av_log(ic, AV_LOG_ERROR, "Error during av_open_input_file\n");
+        av_free(ic);
+        return NULL;
+    }
     err = av_find_stream_info(ic);
-    if (err < 0)
+    if (err < 0) {
         av_log(ic, AV_LOG_ERROR, "Could not find stream info\n");
+        av_free(ic);
+        return NULL;
+    }
     return ic;
 }
 

Modified: concat/libavformat/avplaylist.h
==============================================================================
--- concat/libavformat/avplaylist.h	Mon Aug 24 08:00:51 2009	(r5240)
+++ concat/libavformat/avplaylist.h	Mon Aug 24 08:24:15 2009	(r5241)
@@ -50,7 +50,7 @@ typedef struct AVPlaylistContext {
 
 /** @brief Allocates and opens file, codecs, and streams associated with filename.
  *  @param filename Null-terminated string of file to open.
- *  @return Returns an allocated AVFormatContext.
+ *  @return Returns an allocated AVFormatContext upon success, or NULL upon failure.
  */
 AVFormatContext *av_playlist_alloc_formatcontext(char *filename);
 


More information about the FFmpeg-soc mailing list