From dd0e292992a2a6f2eaf58d58285e15a563a6afe1 Mon Sep 17 00:00:00 2001 From: John Ferlan Date: Tue, 16 Jun 2020 08:07:07 -0400 Subject: [PATCH] conf: Fix memory leak in openvzWriteConfigParam Since 60623a7c, @temp_file was not properly free'd on the non error path. Found by Coverity. Signed-off-by: John Ferlan Reviewed-by: Peter Krempa --- src/openvz/openvz_conf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c index 78547b8b28..c06bfa13e3 100644 --- a/src/openvz/openvz_conf.c +++ b/src/openvz/openvz_conf.c @@ -616,7 +616,7 @@ int openvzLoadDomains(struct openvz_driver *driver) static int openvzWriteConfigParam(const char * conf_file, const char *param, const char *value) { - char * temp_file = NULL; + g_autofree char *temp_file = NULL; int temp_fd = -1; FILE *fp; char *line = NULL; @@ -666,7 +666,6 @@ openvzWriteConfigParam(const char * conf_file, const char *param, const char *va VIR_FORCE_CLOSE(temp_fd); if (temp_file) unlink(temp_file); - VIR_FREE(temp_file); return -1; }