From: Segwon Date: Tue, 21 Nov 2017 06:44:41 +0000 (+0900) Subject: board: do not free a value obtained by a iniparser_getseckeys() X-Git-Tag: submit/tizen_4.0/20171220.125806^2~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F36%2F161036%2F1;p=platform%2Fcore%2Fsystem%2Fperipheral-bus.git 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 --- 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);