From 4aac4547d67d6c2c6c5d2cfc4b23989348926b0e Mon Sep 17 00:00:00 2001 From: Segwon Date: Tue, 21 Nov 2017 15:44:41 +0900 Subject: [PATCH] board: do not free a value obtained by a iniparser_getseckeys() - reference : http://ndevilla.free.fr/iniparser/html/iniparser_8h.html#afa12556355442c567c4b123446f3b309 This function queries a dictionary and finds all keys in a given section. Each pointer in the returned char pointer-to-pointer is pointing to a string allocated in the dictionary do not free or modify them. This function returns NULL in case of error. Change-Id: I62b1e0496aa4faabaf8cbfe11fa5ebfa9ebf33aa Signed-off-by: Segwon --- src/peripheral_bus_board.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/peripheral_bus_board.c b/src/peripheral_bus_board.c index 48e2a0d..23210c2 100644 --- a/src/peripheral_bus_board.c +++ b/src/peripheral_bus_board.c @@ -198,12 +198,14 @@ static pb_board_s *peripheral_bus_board_get_info() section = iniparser_getsecname(dict, i); ret = peripheral_bus_board_get_device_type(section); - if (ret < 0) continue; + if (ret < 0) + continue; enum_dev = (pb_board_dev_e)ret; key_list = iniparser_getseckeys(dict, section); key_num = iniparser_getsecnkeys(dict, section); - if (key_num <= 0) continue; + if (key_num <= 0) + continue; for (j = 0; j < key_num; j++) { dev = &board->dev[cnt_key]; @@ -213,9 +215,6 @@ static pb_board_s *peripheral_bus_board_get_info() dev->num_pins = peripheral_bus_board_ini_parse_pins(key_str, dev->pins); cnt_key++; } - - if (key_list) - free(key_list); } iniparser_freedict(dict); -- 2.34.1