vboxStartMachine() allocates sdlDisplay via g_strdup() and doesn't free it. Replace VIR_FREE calls in the function with g_autofree macro.
Fixes: 3f4f0ef47d (vbox: Fix starting domains) Signed-off-by: Elizaveta Tereshkina <[email protected]> --- src/vbox/vbox_common.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index 65ae9cc651..63401613d5 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -2162,8 +2162,8 @@ vboxStartMachine(virDomainPtr dom, int maxDomID, IMachine *machine) int vrdpPresent = 0; int sdlPresent = 0; int guiPresent = 0; - char *guiDisplay = NULL; - char *sdlDisplay = NULL; + g_autofree char *guiDisplay = NULL; + g_autofree char *sdlDisplay = NULL; PRUnichar *keyTypeUtf16 = NULL; PRUnichar *valueTypeUtf16 = NULL; char *valueTypeUtf8 = NULL; @@ -2233,7 +2233,7 @@ vboxStartMachine(virDomainPtr dom, int maxDomID, IMachine *machine) if (guiPresent || sdlPresent) { const char *display = NULL; const char *sessType = NULL; - char *displayutf8; + g_autofree char *displayutf8 = NULL; if (guiPresent) { sessType = "gui"; @@ -2250,8 +2250,6 @@ vboxStartMachine(virDomainPtr dom, int maxDomID, IMachine *machine) displayutf8 = g_strdup_printf("DISPLAY=%s", display); VBOX_UTF8_TO_UTF16(displayutf8, &env); - VIR_FREE(displayutf8); - VIR_FREE(guiDisplay); VBOX_UTF8_TO_UTF16(sessType, &sessionType); } else if (vrdpPresent) { -- 2.39.2
