From a7566d41580d7a68c52dc61435b05eae208c9222 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 2 May 2001 23:12:37 +0000 Subject: [PATCH] We don't want to teach you bad habbits, so here's a fix for a memleak in the example plugin. Original commit message from CVS: We don't want to teach you bad habbits, so here's a fix for a memleak in the example plugin. --- examples/plugins/example.c | 4 ++++ tests/old/examples/plugins/example.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/examples/plugins/example.c b/examples/plugins/example.c index a2dad20..05db9b1 100644 --- a/examples/plugins/example.c +++ b/examples/plugins/example.c @@ -266,6 +266,10 @@ gst_example_chain (GstPad *pad, GstBuffer *buf) /* Then copy the data in the incoming buffer into the new buffer. */ memcpy (GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (outbuf)); + /* we don't need the incomming buffer anymore so we unref it. When we are + * the last plugin with a handle to the buffer, its memory will be freed */ + gst_buffer_unref (buf); + /* When we're done with the buffer, we push it on to the next element * in the pipeline, through the element's source pad, which is stored * in the element's structure. diff --git a/tests/old/examples/plugins/example.c b/tests/old/examples/plugins/example.c index a2dad20..05db9b1 100644 --- a/tests/old/examples/plugins/example.c +++ b/tests/old/examples/plugins/example.c @@ -266,6 +266,10 @@ gst_example_chain (GstPad *pad, GstBuffer *buf) /* Then copy the data in the incoming buffer into the new buffer. */ memcpy (GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (outbuf)); + /* we don't need the incomming buffer anymore so we unref it. When we are + * the last plugin with a handle to the buffer, its memory will be freed */ + gst_buffer_unref (buf); + /* When we're done with the buffer, we push it on to the next element * in the pipeline, through the element's source pad, which is stored * in the element's structure. -- 2.7.4