summaryrefslogtreecommitdiff
path: root/pcr/qemu-user-static-riscv-git/0003-linux-user-init_guest_space-Clean-up-if-we-can-t-ini.patch
blob: ea9eff138a96e83c34b3a1c8adfb32eccc0bb01a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
From c03d2cc51c5fa496f894b641c035b12e49fd637b Mon Sep 17 00:00:00 2001
From: Luke Shumaker <lukeshu@parabola.nu>
Date: Wed, 27 Dec 2017 14:40:39 -0500
Subject: [PATCH 03/10] linux-user: init_guest_space: Clean up if we can't
 initialize the commpage

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>
---
 linux-user/elfload.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 453394239c..1a6b660b25 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -1886,6 +1886,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. */
-- 
2.15.1