summaryrefslogtreecommitdiff
path: root/src/lib/efreet
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 /src/lib/efreet
parent7d934a4a0de19f72150a177e0caaf76580999a92 (diff)
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 T5949
Diffstat (limited to 'src/lib/efreet')
-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)
86{ 86{
87 Efreet_Xml *xml = NULL; 87 Efreet_Xml *xml = NULL;
88 int size, fd = -1; 88 int size, fd = -1;
89 char *data = MAP_FAILED; 89 char *tmp, *data = MAP_FAILED;
90 struct stat st; 90 struct stat st;
91 int error = 0; 91 int error = 0;
92 92
@@ -109,11 +109,12 @@ efreet_xml_new(const char *file)
109 data = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0); 109 data = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
110 if (data == MAP_FAILED) goto efreet_error; 110 if (data == MAP_FAILED) goto efreet_error;
111 111
112 tmp = data;
113
112 error = 0; 114 error = 0;
113 size = st.st_size; 115 size = st.st_size;
114 xml = efreet_xml_parse(&data, &size, &error); 116 xml = efreet_xml_parse(&tmp, &size, &error);
115 if (!xml || error) goto efreet_error; 117 if (!xml || error) goto efreet_error;
116
117 munmap(data, st.st_size); 118 munmap(data, st.st_size);
118 close(fd); 119 close(fd);
119 return xml; 120 return xml;