[PATCH] textfile: fix missing call to munmap in wite_key

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In some cases it was possible that munmap is not called corresponding
to mmap, which might result in future read or writes to fail.
---
 src/textfile.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

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);
 		}
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux