aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Poole <netstar@gmail.com>2018-03-03 13:13:05 +0000
committerAl Poole <netstar@gmail.com>2018-03-03 13:13:05 +0000
commit300831cb3cbc95b733bdaf4a17617007631a1589 (patch)
tree16f9da0a5c903593bbb17ade980dddc8bec09ea1
parentefl loop - remove commented out code left over from work on theads etc (diff)
downloadefl-300831cb3cbc95b733bdaf4a17617007631a1589.tar.gz
efreet_xml: make sure we unmap the right pointer.
Seems Linux would munmap a lump of coal without failing. Make sure the pointers match. Again bogus unmap not detected by valgrind and not failing. @fix https://phab.enlightenment.org/T5949
-rw-r--r--src/lib/efreet/efreet_xml.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lib/efreet/efreet_xml.c b/src/lib/efreet/efreet_xml.c
index 05261b2a4a..4f4cd2fea8 100644
--- a/src/lib/efreet/efreet_xml.c
+++ b/src/lib/efreet/efreet_xml.c
@@ -86,7 +86,7 @@ efreet_xml_new(const char *file)
{
Efreet_Xml *xml = NULL;
int size, fd = -1;
- char *data = MAP_FAILED;
+ char *tmp, *data = MAP_FAILED;
struct stat st;
int error = 0;
@@ -109,11 +109,12 @@ efreet_xml_new(const char *file)
data = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
if (data == MAP_FAILED) goto efreet_error;
+ tmp = data;
+
error = 0;
size = st.st_size;
- xml = efreet_xml_parse(&data, &size, &error);
+ xml = efreet_xml_parse(&tmp, &size, &error);
if (!xml || error) goto efreet_error;
-
munmap(data, st.st_size);
close(fd);
return xml;