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:
parent
072f6d6e43
commit
dd0e292992
@ -616,7 +616,7 @@ int openvzLoadDomains(struct openvz_driver *driver)
|
|||||||
static int
|
static int
|
||||||
openvzWriteConfigParam(const char * conf_file, const char *param, const char *value)
|
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;
|
int temp_fd = -1;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char *line = NULL;
|
char *line = NULL;
|
||||||
@ -666,7 +666,6 @@ openvzWriteConfigParam(const char * conf_file, const char *param, const char *va
|
|||||||
VIR_FORCE_CLOSE(temp_fd);
|
VIR_FORCE_CLOSE(temp_fd);
|
||||||
if (temp_file)
|
if (temp_file)
|
||||||
unlink(temp_file);
|
unlink(temp_file);
|
||||||
VIR_FREE(temp_file);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user