From 7ae293d5664dfef4cfdaaa641beec38dda9bd547 Mon Sep 17 00:00:00 2001 From: devsaurus Date: Wed, 25 Feb 2015 23:17:08 +0100 Subject: [PATCH] set free'd pointer to NULL --- app/modules/u8g.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/modules/u8g.c b/app/modules/u8g.c index c5dfccd6..0fb26fd3 100644 --- a/app/modules/u8g.c +++ b/app/modules/u8g.c @@ -1002,7 +1002,10 @@ static int lu8g_close_display( lua_State *L ) // free up allocated page buffer if (lud->pb.buf != NULL) + { c_free( lud->pb.buf ); + lud->pb.buf = NULL; + } return 0; } @@ -1033,10 +1036,10 @@ static int lu8g_ssd1306_128x64_i2c( lua_State *L ) // populate and allocate page buffer // constants taken from u8g_dev_ssd1306_128x64.c: - // PAGE_HEIGHT - // | Height - // | | WIDTH - // | | | + // PAGE_HEIGHT + // | Height + // | | WIDTH + // | | | lud->pb = (u8g_pb_t){ { 8, 64, 0, 0, 0 }, 128, NULL }; // if ((lud->pb.buf = (void *)c_zalloc(lud->pb.width)) == NULL)