[FFmpeg-devel] [PATCH 2/2] avformat/aviobuf: Simplify ffio_fdopen()

Michael Niedermayer michaelni at gmx.at
Wed May 21 22:18:53 CEST 2014


Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavformat/aviobuf.c |    7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index e60574d..eca2ae0 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -745,7 +745,6 @@ uint64_t ffio_read_varlen(AVIOContext *bc){
 
 int ffio_fdopen(AVIOContext **s, URLContext *h)
 {
-    uint8_t *buffer;
     int buffer_size, max_packet_size;
 
     max_packet_size = h->max_packet_size;
@@ -754,14 +753,10 @@ int ffio_fdopen(AVIOContext **s, URLContext *h)
     } else {
         buffer_size = IO_BUFFER_SIZE;
     }
-    buffer = av_malloc(buffer_size);
-    if (!buffer)
-        return AVERROR(ENOMEM);
 
-    *s = avio_alloc_context(buffer, buffer_size, h->flags & AVIO_FLAG_WRITE, h,
+    *s = avio_alloc_context(NULL, buffer_size, h->flags & AVIO_FLAG_WRITE, h,
                             (void*)ffurl_read, (void*)ffurl_write, (void*)ffurl_seek);
     if (!*s) {
-        av_free(buffer);
         return AVERROR(ENOMEM);
     }
     (*s)->direct = h->flags & AVIO_FLAG_DIRECT;
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list