From 14828bfdfc5c93a10e04804546bd88666c9504e9 Mon Sep 17 00:00:00 2001 From: Frediano Ziglio Date: Sun, 10 Sep 2017 17:03:11 +0100 Subject: [PATCH] test-gst: Free pipelines Pipelines are never freed. These are detected as leaks by leak detector tools like address sanitizer. Signed-off-by: Frediano Ziglio Acked-by: Christophe Fergeau --- server/tests/test-gst.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/server/tests/test-gst.c b/server/tests/test-gst.c index 302158a2..69633e39 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, @@ -438,6 +439,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); @@ -618,6 +622,17 @@ create_pipeline(const char *desc, SampleProc sample_proc, void *param) return pipeline; } +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) {