Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx> --- src/util/virmacmap.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/util/virmacmap.c b/src/util/virmacmap.c index 0c0ba90def..4a57edede8 100644 --- a/src/util/virmacmap.c +++ b/src/util/virmacmap.c @@ -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; } -- 2.24.1