1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

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 <jferlan@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
John Ferlan 2020-06-16 08:07:07 -04:00 committed by Peter Krempa
parent 072f6d6e43
commit dd0e292992

View File

@ -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;
}