On Thu, 1 Jul 2010, Martin Storsjö wrote:

> On Thu, 1 Jul 2010, Josh Allmann wrote:
> 
> > [lots of things fixed]
> 
> Looks good to me, both of them. The long line in the doxy at the beginning 
> could be wrapped, and if we'd want to be really pedantic, we perhaps 
> should set extradata_size to 0 after av_freep(), since otherwise we could 
> end up with extradata == NULL, but extradata_size > 0 in some situations, 
> which perhaps could make other codepaths crash.
> 
> But no need to resend another patch with those changes now, I'll make the 
> changes when I apply them.

Actually, the url_close_dyn_buf fix needs a minor adjustment, as in the 
attached patch, I'll squash that in when applying. (I see you didn't 
valgrind your code this time. ;P)

// Martin
From 84a807802b1a1c8b7d9b4ac35b73a225e290cd5b Mon Sep 17 00:00:00 2001
From: Martin Storsjo <[email protected]>
Date: Thu, 1 Jul 2010 23:06:37 +0300
Subject: [PATCH] url_close_dyn_buf: Don't refer to s->max_packet_size after freeing s

---
 libavformat/aviobuf.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index d9eb422..df4ea60 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -895,10 +895,13 @@ int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer)
     DynBuffer *d = s->opaque;
     int size;
     static const char padbuf[FF_INPUT_BUFFER_PADDING_SIZE] = {0};
+    int padding = 0;
 
     /* don't attempt to pad fixed-size packet buffers */
-    if (!s->max_packet_size)
+    if (!s->max_packet_size) {
         put_buffer(s, padbuf, sizeof(padbuf));
+        padding = FF_INPUT_BUFFER_PADDING_SIZE;
+    }
 
     put_flush_packet(s);
 
@@ -906,6 +909,6 @@ int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer)
     size = d->size;
     av_free(d);
     av_free(s);
-    return size - (s->max_packet_size ? 0 : FF_INPUT_BUFFER_PADDING_SIZE);
+    return size - padding;
 }
 #endif /* CONFIG_MUXERS || CONFIG_NETWORK */
-- 
1.7.1

_______________________________________________
FFmpeg-soc mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc

Reply via email to