board: do not free a value obtained by a iniparser_getseckeys() 36/161036/1
authorSegwon <segwon.han@samsung.com>
Tue, 21 Nov 2017 06:44:41 +0000 (15:44 +0900)
committerSegwon <segwon.han@samsung.com>
Tue, 21 Nov 2017 06:44:41 +0000 (15:44 +0900)
 - 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 <segwon.han@samsung.com>
src/peripheral_bus_board.c

index 48e2a0d98df8b3e9d53cdb864e2bf9cf8ad974f1..23210c27c073e8c94cdf098c2ac9dc78e7d2d057 100644 (file)
@@ -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);