[PATCH 12/34] kernelshark: Fix potential access to uninitialized variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If "nStreams" is zero, jstream may be accessed while uninitialized
in KsSession::_savePlots() and in KsSession::_getPlots()

Signed-off-by: Benjamin ROBIN <dev@xxxxxxxxxxxxx>
---
 src/KsSession.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/KsSession.cpp b/src/KsSession.cpp
index b9edb3a..af86281 100644
--- a/src/KsSession.cpp
+++ b/src/KsSession.cpp
@@ -348,7 +348,7 @@ void KsSession::loadGraphs(kshark_context *kshark_ctx,
 void KsSession::_savePlots(int sd, KsGLWidget *glw, bool cpu)
 {
 	kshark_config_doc *streamsConf = kshark_config_alloc(KS_CONFIG_JSON);
-	json_object *jallStreams, *jstream, *jstreamId, *jplots;
+	json_object *jallStreams, *jstream = nullptr, *jstreamId, *jplots;
 	QVector<int> plotIds;
 	int nStreams;
 
@@ -438,7 +438,7 @@ void KsSession::_saveComboPlots(KsGLWidget *glw)
 QVector<int> KsSession::_getPlots(int sd, bool cpu)
 {
 	kshark_config_doc *streamsConf = kshark_config_alloc(KS_CONFIG_JSON);
-	json_object *jallStreams, *jstream, *jstreamId, *jplots;
+	json_object *jallStreams, *jstream = nullptr, *jstreamId, *jplots;
 	int nStreams, nPlots, id;
 	const char *plotKey;
 	QVector<int> plots;
-- 
2.43.0





[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux