[PATCH] Make avfilter_unref_buffer() accept a NULL parameter.

Stefano Sabatini stefano.sabatini-lala
Sat Jan 15 12:47:49 CET 2011


---
 libavfilter/avfilter.c |    2 ++
 libavfilter/avfilter.h |    2 +-
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 9812610..b19054b 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -71,6 +71,8 @@ AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask)
 
 void avfilter_unref_buffer(AVFilterBufferRef *ref)
 {
+    if (!buf)
+        return;
     if (!(--ref->buf->refcount))
         ref->buf->free(ref->buf);
     av_free(ref->video);
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 15d440a..d2a275e 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -177,7 +177,7 @@ AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask);
  * Remove a reference to a buffer. If this is the last reference to the
  * buffer, the buffer itself is also automatically freed.
  *
- * @param ref reference to the buffer
+ * @param ref reference to the buffer, may be NULL
  */
 void avfilter_unref_buffer(AVFilterBufferRef *ref);
 
-- 
1.7.2.3


--+QahgC5+KEYLbs62--



More information about the ffmpeg-devel mailing list