[Spice-devel] [PATCH spice-server v2 3/3] test-gst: Free pipelines
Frediano Ziglio
fziglio at redhat.com
Tue Sep 12 07:25:58 UTC 2017
Pipelines are never freed.
These are detected as leaks by leak detector tools like address sanitizer.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
server/tests/test-gst.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
Changes since v1:
- improved commit message.
diff --git a/server/tests/test-gst.c b/server/tests/test-gst.c
index a78432eaa..83cec5fb8 100644
--- a/server/tests/test-gst.c
+++ b/server/tests/test-gst.c
@@ -172,6 +172,7 @@ static TestFrame *gst_to_spice_frame(GstSample *sample);
static void bitmap_free(SpiceBitmap *bitmap);
static void frame_ref(TestFrame *frame);
static void frame_unref(TestFrame *frame);
+static void pipeline_free(TestPipeline *pipeline);
static void pipeline_send_raw_data(TestPipeline *pipeline, VideoBuffer *buffer);
static void pipeline_wait_eos(TestPipeline *pipeline);
static void create_input_pipeline(const char *input_pipeline,
@@ -434,6 +435,9 @@ int main(int argc, char *argv[])
exit(1);
}
+ pipeline_free(input_pipeline);
+ pipeline_free(output_pipeline);
+
g_free(encoder_name);
g_free(image_format);
g_free(input_pipeline_desc);
@@ -615,6 +619,17 @@ create_pipeline(const char *desc, SampleProc sample_proc, void *param)
}
static void
+pipeline_free(TestPipeline *pipeline)
+{
+ if (pipeline->appsrc) {
+ gst_object_unref(pipeline->appsrc);
+ }
+ gst_object_unref(pipeline->appsink);
+ gst_object_unref(pipeline->gst_pipeline);
+ free(pipeline);
+}
+
+static void
create_output_pipeline(const EncoderInfo *encoder, SampleProc sample_proc, void *param)
{
gchar *desc =
--
2.13.5
More information about the Spice-devel
mailing list