Commit e8f89a814e6180abf6601099bf2917ffb3d221c9

Stefan Sperling 2018-07-13T10:38:31

only unmap map if non-NULL in got_pack_close()

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/lib/pack.c b/lib/pack.c
index 2f68648..1c66bfa 100644
--- a/lib/pack.c
+++ b/lib/pack.c
@@ -645,7 +645,7 @@ got_pack_close(struct got_pack *pack)
 {
 	const struct got_error *err = NULL;
 
-	if (munmap(pack->map, pack->filesize) == -1)
+	if (pack->map && munmap(pack->map, pack->filesize) == -1)
 		err = got_error_from_errno();
 	close(pack->fd);
 	pack->fd = -1;