libxc: only munmap when something has actually been mapped in change_pte
authorMatthew Daley <mattjd@gmail.com>
Sun, 29 Sep 2013 01:35:02 +0000 (14:35 +1300)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 3 Oct 2013 13:06:43 +0000 (14:06 +0100)
Coverity-ID: 1055269
signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxc/xc_offline_page.c

index fbb53f5f0ff707269ae48b671aeab83b28ddef9e..8195efb9528f6e717739dcb42c9a3b64c7d10882 100644 (file)
@@ -317,10 +317,10 @@ static int change_pte(xc_interface *xch, int domid,
                     goto failed;
                 }
             }
-        }
 
-        munmap(content, PAGE_SIZE);
-        content = NULL;
+            munmap(content, PAGE_SIZE);
+            content = NULL;
+        }
     }
 
     if ( xc_flush_mmu_updates(xch, mmu) )