Diff between 6e6e6af1406a6659e40f42aee4379df565761fa9 and 96965948de16da000b29fcdc31c5af270b69bd1a

Changed Files

File Additions Deletions Status
src/textfile.c +1 -1 modified

Full Patch

diff --git a/src/textfile.c b/src/textfile.c
index 2712cd8..9d88fbc 100644
--- a/src/textfile.c
+++ b/src/textfile.c
@@ -220,8 +220,8 @@ static int write_key(const char *pathname, const char *key, const char *value, i
 	len = strlen(key);
 	off = find_key(map, size, key, len, icase);
 	if (!off) {
+		munmap(map, size);
 		if (value) {
-			munmap(map, size);
 			lseek(fd, size, SEEK_SET);
 			err = write_key_value(fd, key, value);
 		}