From d0ac061eafaa8e8e471eab4f956c9e2792e94915 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Mon, 19 Nov 2018 12:35:45 +0100 Subject: Uemis downloader: free ans_path on error In a few instances, the ans_path was not freed on error. Fix them. Signed-off-by: Berthold Stoeger --- core/uemis-downloader.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/uemis-downloader.c b/core/uemis-downloader.c index 6d96975b9..52b4276c2 100644 --- a/core/uemis-downloader.c +++ b/core/uemis-downloader.c @@ -606,10 +606,13 @@ static bool uemis_get_answer(const char *path, char *request, int n_param_in, #ifdef UEMIS_DEBUG fprintf(debugfile, "open %s failed with errno %d\n", ans_path, errno); #endif + free(ans_path); return false; } - if (read(ans_file, tmp, 100) < 0) + if (read(ans_file, tmp, 100) < 0) { + free(ans_path); return false; + } close(ans_file); #if UEMIS_DEBUG & 8 tmp[100] = '\0'; @@ -670,6 +673,7 @@ static bool uemis_get_answer(const char *path, char *request, int n_param_in, #ifdef UEMIS_DEBUG fprintf(debugfile, "open %s failed with errno %d\n", ans_path, errno); #endif + free(ans_path); return false; } free(ans_path); @@ -707,6 +711,7 @@ static bool uemis_get_answer(const char *path, char *request, int n_param_in, #ifdef UEMIS_DEBUG fprintf(debugfile, "open %s failed with errno %d\n", ans_path, errno); #endif + free(ans_path); return false; } -- cgit v1.2.3-70-g09d2