mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 05:45:59 +03:00
Removes a memory leak on the JSON parser
This commit is contained in:
parent
145f2f35b7
commit
2dff768262
2
CHANGES
2
CHANGES
@ -1,6 +1,8 @@
|
|||||||
v3.0.4 - YYYY-MMM-DD (to be released)
|
v3.0.4 - YYYY-MMM-DD (to be released)
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
|
|
||||||
|
- Removes a memory leak on the JSON parser
|
||||||
|
[@zimmerle]
|
||||||
- Enables LMDB on the regression tests.
|
- Enables LMDB on the regression tests.
|
||||||
[Issue #2011, #2008 - @WGH-, @mdunc]
|
[Issue #2011, #2008 - @WGH-, @mdunc]
|
||||||
- Fix: Extra whitespace in some configuration directives causing error
|
- Fix: Extra whitespace in some configuration directives causing error
|
||||||
|
@ -87,10 +87,11 @@ bool JSON::processChunk(const char *buf, unsigned int size, std::string *err) {
|
|||||||
m_status = yajl_parse(m_handle,
|
m_status = yajl_parse(m_handle,
|
||||||
(const unsigned char *)buf, size);
|
(const unsigned char *)buf, size);
|
||||||
if (m_status != yajl_status_ok) {
|
if (m_status != yajl_status_ok) {
|
||||||
const unsigned char *e = yajl_get_error(m_handle, 0,
|
unsigned char *e = yajl_get_error(m_handle, 0,
|
||||||
(const unsigned char *)buf, size);
|
(const unsigned char *)buf, size);
|
||||||
/* We need to free the yajl error message later, how to do this? */
|
/* We need to free the yajl error message later, how to do this? */
|
||||||
err->assign((const char *)e);
|
err->assign((const char *)e);
|
||||||
|
yajl_free_error(m_handle, e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,9 +103,10 @@ bool JSON::complete(std::string *err) {
|
|||||||
/* Wrap up the parsing process */
|
/* Wrap up the parsing process */
|
||||||
m_status = yajl_complete_parse(m_handle);
|
m_status = yajl_complete_parse(m_handle);
|
||||||
if (m_status != yajl_status_ok) {
|
if (m_status != yajl_status_ok) {
|
||||||
const unsigned char *e = yajl_get_error(m_handle, 0, NULL, 0);
|
unsigned char *e = yajl_get_error(m_handle, 0, NULL, 0);
|
||||||
/* We need to free the yajl error message later, how to do this? */
|
/* We need to free the yajl error message later, how to do this? */
|
||||||
err->assign((const char *)e);
|
err->assign((const char *)e);
|
||||||
|
yajl_free_error(m_handle, e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user