DBoxLCD: Initialize _buffer to prevent segfault
authorAthanasios Oikonomou <athoik@gmail.com>
Sun, 6 Dec 2015 19:36:08 +0000 (21:36 +0200)
committerErik Slagter <erik@openpli.org>
Mon, 7 Dec 2015 14:16:06 +0000 (15:16 +0100)
Since commit ac977040b7c9fa3474272a1568e5f00b4963c1eb
when the box has no LCD on destructor we are trying
to free non initialized memory causing segfault.

Initialize _buffer to NULL to prevent this from happen.

(cherry picked from commit 0c49846d922b672d94530a734b61b37ba40da213)
Signed-off-by: Erik Slagter <erik@openpli.org>

lib/gdi/lcd.cpp

index 865fa39..e15c4f6 100644 (file)
@@ -16,6 +16,7 @@ eLCD *eLCD::instance;
 
 eLCD::eLCD()
 {
+       _buffer = 0;
        lcdfd = -1;
        locked = 0;
        instance = this;