summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRatchanan Srirattanamet <ratchanan@ubports.com>2020-09-10 00:30:41 +0700
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-09-11 14:12:52 +0000
commit9fc291c75f5fae829deeb01ceba303ad67f4a533 (patch)
treef7eae27141c2dbf3247ac495030b0713edbbebe7
parent8b127d7ff751a6308666f91d111e75c36e620907 (diff)
CameraBin: unset GValues after finish using them
GValue can contain allocated memory. Not unsetting it can cause memory leak. This patch adds g_value_unset() calls to various places that miss ones. Change-Id: I78e0f8f6c558ada0e7828c11094132359c579c2a Reviewed-by: Val Doroshchuk <valentyn.doroshchuk@qt.io> (cherry picked from commit 24ac478e50dab189b53c749b34971a807aa6da4d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinsession.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.cpp b/src/plugins/gstreamer/camerabin/camerabinsession.cpp
index 23cbd6082..6cc7e7e28 100644
--- a/src/plugins/gstreamer/camerabin/camerabinsession.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinsession.cpp
@@ -1304,6 +1304,7 @@ QList< QPair<int,int> > CameraBinSession::supportedFrameRates(const QSize &frame
g_value_copy(oldRate, &rate);
gst_structure_remove_all_fields(structure);
gst_structure_set_value(structure, "framerate", &rate);
+ g_value_unset(&rate);
}
#if GST_CHECK_VERSION(1,0,0)
caps = gst_caps_simplify(caps);
@@ -1422,6 +1423,8 @@ QList<QSize> CameraBinSession::supportedResolutions(QPair<int,int> rate,
gst_structure_remove_all_fields(structure);
gst_structure_set_value(structure, "width", &w);
gst_structure_set_value(structure, "height", &h);
+ g_value_unset(&w);
+ g_value_unset(&h);
}
#if GST_CHECK_VERSION(1,0,0)