helper/configuration: free script_search_dirs and config_file_names
Although the leak is negligible, the clean heap on exit will ease valgrind testing. Change-Id: If43f02fe594c30ceb1bea3259ea3e098d4b2d239 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4408 Tested-by: jenkins Reviewed-by: Marc Schink <openocd-dev@marcschink.de>
This commit is contained in:
@@ -51,6 +51,21 @@ void add_config_command(const char *cfg)
|
||||
config_file_names[num_config_files] = NULL;
|
||||
}
|
||||
|
||||
void free_config(void)
|
||||
{
|
||||
while (num_config_files)
|
||||
free(config_file_names[--num_config_files]);
|
||||
|
||||
free(config_file_names);
|
||||
config_file_names = NULL;
|
||||
|
||||
while (num_script_dirs)
|
||||
free(script_search_dirs[--num_script_dirs]);
|
||||
|
||||
free(script_search_dirs);
|
||||
script_search_dirs = NULL;
|
||||
}
|
||||
|
||||
/* return full path or NULL according to search rules */
|
||||
char *find_file(const char *file)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user