File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -78,7 +78,11 @@ class QwOLEDCustom : public QwGrSSD1306 {
7878 default_address = kOLEDCustomDefaultDefaultAddress ;
7979 };
8080
81- ~QwOLEDCustom (){if (m_graphicsBuffer != nullptr ) delete m_graphicsBuffer;};
81+ ~QwOLEDCustom ()
82+ {
83+ if (m_graphicsBuffer != nullptr )
84+ delete[] m_graphicsBuffer;
85+ };
8286
8387 // set up the specific device settings
8488 bool init (void )
@@ -90,8 +94,9 @@ class QwOLEDCustom : public QwGrSSD1306 {
9094 setVcomDeselect (vcomDeselect);
9195 setContrast (contrast);
9296
93- if (m_graphicsBuffer == nullptr )
94- m_graphicsBuffer = new uint8_t [(uint16_t )displayWidth * (uint16_t )displayHeight / 8 ];
97+ if (m_graphicsBuffer != nullptr )
98+ delete[] m_graphicsBuffer;
99+ m_graphicsBuffer = new uint8_t [(uint16_t )displayWidth * (uint16_t )displayHeight / 8 ];
95100 setBuffer (m_graphicsBuffer); // The buffer to use
96101
97102 // Call the super class to do all the work
You can’t perform that action at this time.
0 commit comments