diff options
| author | Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> | 2025-09-13 18:37:51 +0300 |
|---|---|---|
| committer | Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> | 2025-12-18 12:23:57 +0200 |
| commit | 65b0414775f0674cfb9aff0863a5be8c0d72dfaa (patch) | |
| tree | 9e5386f37a8999f74378e033f43bc815d5ddada7 | |
| parent | de2346e9ba06d15d5839fe0a3b3f61f474c5bedb (diff) | |
fix: Initialize uninitialized member variables
This commit addresses cppcheck warnings about member variables that are
not properly initialized in constructors (uninitMemberVar). Uninitialized
member variables can lead to undefined behavior and unpredictable program
execution, making this a critical bug fix.
Changes made:
- kmscube/cube-gles2.cpp: Initialize m_width and m_height to 0 in GlScene
constructor to prevent undefined behavior when these values are used
- utils/kmstest.cpp: Initialize m_frame_num and m_flip_count to 0 in
FlipState constructor to ensure proper frame counting behavior
These fixes prevent potential crashes and ensure deterministic behavior
by providing proper initial values for all member variables.
| -rw-r--r-- | kmscube/cube-gles2.cpp | 1 | ||||
| -rw-r--r-- | utils/kmstest.cpp | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/kmscube/cube-gles2.cpp b/kmscube/cube-gles2.cpp index 0e52a32..d96115d 100644 --- a/kmscube/cube-gles2.cpp +++ b/kmscube/cube-gles2.cpp @@ -7,6 +7,7 @@ using namespace std; GlScene::GlScene() + : m_width(0), m_height(0) { GLuint vertex_shader, fragment_shader; GLint ret; diff --git a/utils/kmstest.cpp b/utils/kmstest.cpp index c6efb45..36f7409 100644 --- a/utils/kmstest.cpp +++ b/utils/kmstest.cpp @@ -969,7 +969,7 @@ class FlipState : private PageFlipHandlerBase { public: FlipState(Card& card, const string& name, const vector<const OutputInfo*>& outputs) - : m_card(card), m_name(name), m_outputs(outputs) + : m_card(card), m_name(name), m_outputs(outputs), m_frame_num(0), m_flip_count(0) { } |
