Most other close/unmap functions are.

Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com>
---
CC: Ian Jackson <ian.jack...@citrix.com>
CC: Wei Liu <wei.l...@citrix.com>
CC: Paul Durrant <paul.durr...@citrix.com>

This ideally wants backporting to 4.11 to hit 4.11.1

I got an unexpected shock while trying to diagnose why GVT-g is still
broken (differently!) on staging.
---
 tools/libs/foreignmemory/core.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/libs/foreignmemory/core.c b/tools/libs/foreignmemory/core.c
index 63f12e2..2516fd4 100644
--- a/tools/libs/foreignmemory/core.c
+++ b/tools/libs/foreignmemory/core.c
@@ -182,7 +182,12 @@ xenforeignmemory_resource_handle 
*xenforeignmemory_map_resource(
 int xenforeignmemory_unmap_resource(
     xenforeignmemory_handle *fmem, xenforeignmemory_resource_handle *fres)
 {
-    int rc = osdep_xenforeignmemory_unmap_resource(fmem, fres);
+    int rc;
+
+    if ( !fres )
+        return 0;
+
+    rc = osdep_xenforeignmemory_unmap_resource(fmem, fres);
 
     free(fres);
     return rc;
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to