]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/xen.git/commitdiff
libxl: Clear file object on successful munmap()
authorSigned-off-by: Jim Fehlig <jfehlig@novell.com>
Thu, 17 Feb 2011 19:52:20 +0000 (19:52 +0000)
committerSigned-off-by: Jim Fehlig <jfehlig@novell.com>
Thu, 17 Feb 2011 19:52:20 +0000 (19:52 +0000)
Clear members of libxl_file_reference when file is successfully unmapped.

Signed-off-by: Jim Fehlig <jfehlig@novell.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxl/libxl_internal.c

index b50c2418bbbc30a4dbc64ca5546144f0caecf154..2aa87f718198c1a70f0002173f10c30f1554b67f 100644 (file)
@@ -233,6 +233,12 @@ int libxl__file_reference_unmap(libxl_file_reference *f)
                return 0;
 
        ret = munmap(f->data, f->size);
+       if (ret == 0) {
+               f->mapped = 0;
+               f->data = NULL;
+               f->size = 0;
+               return 0;
+       }
 
-       return ret == 0 ? 0 : ERROR_FAIL;
+       return ERROR_FAIL;
 }