mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 07:17:44 +00:00
virmacmap: Use g_autofree in virMacMapWriteFileLocked
Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
4f77a9c629
commit
e7741937eb
@ -261,19 +261,15 @@ static int
|
||||
virMacMapWriteFileLocked(virMacMapPtr mgr,
|
||||
const char *file)
|
||||
{
|
||||
char *str;
|
||||
int ret = -1;
|
||||
g_autofree char *str = NULL;
|
||||
|
||||
if (virMacMapDumpStrLocked(mgr, &str) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (virFileRewriteStr(file, 0644, str) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
VIR_FREE(str);
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user