diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/xml.c | 8 |
1 files changed, 8 insertions, 0 deletions
| @@ -202,6 +202,11 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, | |||
| 202 | } | 202 | } |
| 203 | 203 | ||
| 204 | buftext = BYTE_POS_ADDR (istart_byte); | 204 | buftext = BYTE_POS_ADDR (istart_byte); |
| 205 | #ifdef REL_ALLOC | ||
| 206 | /* Prevent ralloc.c from relocating the current buffer while libxml2 | ||
| 207 | functions below read its text. */ | ||
| 208 | r_alloc_inhibit_buffer_relocation (1); | ||
| 209 | #endif | ||
| 205 | if (htmlp) | 210 | if (htmlp) |
| 206 | doc = htmlReadMemory ((char *)buftext, | 211 | doc = htmlReadMemory ((char *)buftext, |
| 207 | iend_byte - istart_byte, burl, "utf-8", | 212 | iend_byte - istart_byte, burl, "utf-8", |
| @@ -214,6 +219,9 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, | |||
| 214 | XML_PARSE_NONET|XML_PARSE_NOWARNING| | 219 | XML_PARSE_NONET|XML_PARSE_NOWARNING| |
| 215 | XML_PARSE_NOBLANKS |XML_PARSE_NOERROR); | 220 | XML_PARSE_NOBLANKS |XML_PARSE_NOERROR); |
| 216 | 221 | ||
| 222 | #ifdef REL_ALLOC | ||
| 223 | r_alloc_inhibit_buffer_relocation (0); | ||
| 224 | #endif | ||
| 217 | /* If the assertion below fails, malloc was called inside the above | 225 | /* If the assertion below fails, malloc was called inside the above |
| 218 | libxml2 functions, and ralloc.c caused relocation of buffer text, | 226 | libxml2 functions, and ralloc.c caused relocation of buffer text, |
| 219 | so we could have read from unrelated memory. */ | 227 | so we could have read from unrelated memory. */ |