linux-user: init_guest_space: Clean up if we can't initialize the commpage
authorLuke Shumaker <lukeshu@parabola.nu>
Thu, 28 Dec 2017 18:08:06 +0000 (13:08 -0500)
committerLaurent Vivier <laurent@vivier.eu>
Fri, 9 Mar 2018 20:24:22 +0000 (21:24 +0100)
We'll just exit with an error anyway, so it doesn't really matter, but it
is cleaned up in all of the other places were we error out.

Signed-off-by: Luke Shumaker <lukeshu@parabola.nu>
Message-Id: <20171228180814.9749-4-lukeshu@lukeshu.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
linux-user/elfload.c

index eaa52afe799e6e2237539c337d24d7d4b8e2baae..dcdd75690815596b62883afb81c013a3a6a0baab 100644 (file)
@@ -1860,6 +1860,7 @@ unsigned long init_guest_space(unsigned long host_start,
             if (valid == 1) {
                 break;
             } else if (valid == -1) {
+                munmap((void *)real_start, host_size);
                 return (unsigned long)-1;
             }
             /* valid == 0, so try again. */