Browse code

avfilter: add some asserts() to check refcounts.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2012/01/23 03:30:40
Showing 1 changed files
... ...
@@ -92,6 +92,7 @@ static void free_pool(AVFilterPool *pool)
92 92
             AVFilterBufferRef *picref = pool->pic[i];
93 93
             /* free buffer: picrefs stored in the pool are not
94 94
              * supposed to contain a free callback */
95
+            av_assert0(!picref->buf->refcount);
95 96
             av_freep(&picref->buf->data[0]);
96 97
             av_freep(&picref->buf);
97 98
 
... ...
@@ -146,6 +147,7 @@ void avfilter_unref_buffer(AVFilterBufferRef *ref)
146 146
 {
147 147
     if (!ref)
148 148
         return;
149
+    av_assert0(ref->buf->refcount > 0);
149 150
     if (!(--ref->buf->refcount)) {
150 151
         if (!ref->buf->free) {
151 152
             store_in_pool(ref);