From: OpenOCD-Gerrit <ope...@us...> - 2022-06-24 21:55:09
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via a70bab9e5185c8853882748737ceebabde7c4781 (commit) from 573a39b36cf133bb7403b12337301a5616112f1a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a70bab9e5185c8853882748737ceebabde7c4781 Author: Antonio Borneo <bor...@gm...> Date: Sun Jun 19 22:10:47 2022 +0200 helper: fix build with mingw gcc 12.1.0 New mingw compiler correctly complains for using a freed memory area: src/helper/configuration.c: In function 'get_home_dir': src/helper/configuration.c:182:29: error: dangling pointer 'home' to 'homepath' may be used [-Werror=dangling-pointer=] 182 | home_path = alloc_printf("%s/%s", home, append_path); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In fact the variable 'homepath' is declared inside an 'if' branch and is not available outside. Move the declaration of 'homepath' to have it available in a wider context. Change-Id: I4a43a03c007c9f0d5c4cee962a9f7cc83ca49637 Signed-off-by: Antonio Borneo <bor...@gm...> Reported-by: Dietmar May <die...@ou...> Reviewed-on: https://review.openocd.org/c/openocd/+/7038 Tested-by: jenkins Reviewed-by: Dietmar May <die...@ou...> diff --git a/src/helper/configuration.c b/src/helper/configuration.c index 7e791d084..614892c8a 100644 --- a/src/helper/configuration.c +++ b/src/helper/configuration.c @@ -148,6 +148,10 @@ int parse_config_file(struct command_context *cmd_ctx) char *get_home_dir(const char *append_path) { +#ifdef _WIN32 + char homepath[MAX_PATH]; +#endif + char *home = getenv("HOME"); if (!home) { @@ -156,8 +160,6 @@ char *get_home_dir(const char *append_path) home = getenv("USERPROFILE"); if (!home) { - - char homepath[MAX_PATH]; char *drive = getenv("HOMEDRIVE"); char *path = getenv("HOMEPATH"); if (drive && path) { ----------------------------------------------------------------------- Summary of changes: src/helper/configuration.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) hooks/post-receive -- Main OpenOCD repository |