mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
esx: reorder code to avoid need to VIR_FREE mimeType
mimeType is initialized to NULL, and then only set in one place, just before a check (not involving mimeType) that then VIR_FREEs mimeType if it fails. If we just reorder the code to do the check prior to setting mimeType, then there won't be any need to VIR_FREE(mimeType) on failure (because it will already be empty/NULL). Signed-off-by: Laine Stump <laine@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
33d3ebff71
commit
0a69fa61cd
@ -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:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user