diff options
author | Michael Niedermayer <[email protected]> | 2012-01-12 02:32:41 +0100 |
---|---|---|
committer | Michael Niedermayer <[email protected]> | 2012-01-12 16:32:54 +0100 |
commit | f068ce570f7c378106bd7afdad6455b22ac28020 (patch) | |
tree | fb7b3a5b7d9e9ad3dbc7ec9fc8e1165c64e06f0a /libavfilter/defaults.c | |
parent | 4fd1e2e43233960f122a2c16841834d388d77c60 (diff) |
avfilter: pool draining and self destruction support.
This should fix a memleak.
Signed-off-by: Michael Niedermayer <[email protected]>
Diffstat (limited to 'libavfilter/defaults.c')
-rw-r--r-- | libavfilter/defaults.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libavfilter/defaults.c b/libavfilter/defaults.c index 5f18168374..c083195b4f 100644 --- a/libavfilter/defaults.c +++ b/libavfilter/defaults.c @@ -57,11 +57,14 @@ AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link, int per pic->refcount = 1; memcpy(picref->data, pic->data, sizeof(picref->data)); memcpy(picref->linesize, pic->linesize, sizeof(picref->linesize)); + pool->refcount++; return picref; } } - } else + } else { pool = link->pool = av_mallocz(sizeof(AVFilterPool)); + pool->refcount = 1; + } // align: +2 is needed for swscaler, +16 to be SIMD-friendly if ((i = av_image_alloc(data, linesize, w, h, link->format, 32)) < 0) @@ -77,6 +80,7 @@ AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link, int per picref->buf->priv = pool; picref->buf->free = NULL; + pool->refcount++; return picref; } |