diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index 47873c0d54..2d010096a5 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -2374,12 +2374,10 @@ esxDomainScreenshot(virDomainPtr domain, virStreamPtr stream, url = virBufferContentAndReset(&buffer); - mimeType = g_strdup("image/png"); - - if (esxStreamOpenDownload(stream, priv, url, 0, 0) < 0) { - VIR_FREE(mimeType); + if (esxStreamOpenDownload(stream, priv, url, 0, 0) < 0) goto cleanup; - } + + mimeType = g_strdup("image/png"); cleanup: