summaryrefslogtreecommitdiff
path: root/test/gstreamer
diff options
context:
space:
mode:
authorVedant Paranjape <vedantparanjape160201@gmail.com>2021-09-21 23:09:53 +0530
committerPaul Elder <paul.elder@ideasonboard.com>2021-09-23 16:03:01 +0900
commitca9ea1f9ce37c70db885d14a1698063da04e0169 (patch)
tree6b48c04ede3276fffa90a26ed60e6b1c6ed9c35f /test/gstreamer
parent8d3d92ea81a1a5e52a27684aee3c4161d7dc96a7 (diff)
test: gstreamer_single_stream_test: Fix memory leak
The test hold a valid reference to convert0_ and sink0_ but not released. This results in a memory leak and can be checked via valgrind. Drop the references with test cleanup() virtual function. Valgrind log (glib and gst suppression files were used): ==345380== LEAK SUMMARY: ==345380== definitely lost: 1,688 bytes in 2 blocks ==345380== indirectly lost: 7,069 bytes in 42 blocks The patch fixes the leaks reported by valgrind above to: ==348870== LEAK SUMMARY: ==348870== definitely lost: 0 bytes in 0 blocks ==348870== indirectly lost: 0 bytes in 0 blocks Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Diffstat (limited to 'test/gstreamer')
-rw-r--r--test/gstreamer/gstreamer_single_stream_test.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/gstreamer/gstreamer_single_stream_test.cpp b/test/gstreamer/gstreamer_single_stream_test.cpp
index 7292f328..2b561d6b 100644
--- a/test/gstreamer/gstreamer_single_stream_test.cpp
+++ b/test/gstreamer/gstreamer_single_stream_test.cpp
@@ -72,6 +72,12 @@ protected:
return TestPass;
}
+ void cleanup() override
+ {
+ g_clear_object(&convert0_);
+ g_clear_object(&sink0_);
+ }
+
private:
GstElement *convert0_;
GstElement *sink0_;