From 65f7d2a2508140830add058e243ab6bcbe97e06f Mon Sep 17 00:00:00 2001 From: Noel Eck Date: Wed, 29 Mar 2017 22:04:25 -0700 Subject: [PATCH] mraa.c: Fix for various small memory leaks In the process of using the mraa mock platform to identify memory leaks in UPM libraries. This commit fixes some non-critical places where memory was getting lost in mraa. Signed-off-by: Noel Eck Signed-off-by: Brendan Le Foll --- src/mraa.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/mraa.c b/src/mraa.c index e713a6d..7863ede 100644 --- a/src/mraa.c +++ b/src/mraa.c @@ -230,11 +230,17 @@ mraa_deinit() if (plat->pins != NULL) { free(plat->pins); } + if (plat->adv_func != NULL) { + free(plat->adv_func); + } mraa_board_t* sub_plat = plat->sub_platform; if (sub_plat != NULL) { if (sub_plat->pins != NULL) { free(sub_plat->pins); } + if (sub_plat->adv_func != NULL) { + free(sub_plat->adv_func); + } free(sub_plat); } #if defined(JSONPLAT) @@ -252,6 +258,11 @@ mraa_deinit() #endif free(plat); + if (lang_func != NULL) + free(lang_func); + + if (platform_name != NULL) + free(platform_name); } if (plat_iio != NULL) { free(plat_iio);