[FFmpeg-devel] [PATCH] Make avfilter_unref_buffer() return immediately if ref is NULL.
Stefano Sabatini
stefano.sabatini-lala
Sat Dec 4 19:39:01 CET 2010
---
libavfilter/avfilter.c | 2 ++
libavfilter/avfilter.h | 1 +
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index db254d6..e2a3ac9 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -70,6 +70,8 @@ AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask)
void avfilter_unref_buffer(AVFilterBufferRef *ref)
{
+ if (!ref)
+ 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 5d34bee..b675216 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -171,6 +171,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.
+ * If ref is NULL, do nothing.
*
* @param ref reference to the buffer
*/
--
1.7.2.3
More information about the ffmpeg-devel
mailing list