only unmap map if non-NULL in got_pack_close()
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;