@@ -87,10 +87,11 @@ bool JSON::processChunk(const char *buf, unsigned int size, std::string *err) {
87
87
m_status = yajl_parse (m_handle,
88
88
(const unsigned char *)buf, size);
89
89
if (m_status != yajl_status_ok) {
90
- const unsigned char *e = yajl_get_error (m_handle, 0 ,
90
+ unsigned char *e = yajl_get_error (m_handle, 0 ,
91
91
(const unsigned char *)buf, size);
92
92
/* We need to free the yajl error message later, how to do this? */
93
93
err->assign ((const char *)e);
94
+ yajl_free_error (m_handle, e);
94
95
return false ;
95
96
}
96
97
@@ -102,9 +103,10 @@ bool JSON::complete(std::string *err) {
102
103
/* Wrap up the parsing process */
103
104
m_status = yajl_complete_parse (m_handle);
104
105
if (m_status != yajl_status_ok) {
105
- const unsigned char *e = yajl_get_error (m_handle, 0 , NULL , 0 );
106
+ unsigned char *e = yajl_get_error (m_handle, 0 , NULL , 0 );
106
107
/* We need to free the yajl error message later, how to do this? */
107
108
err->assign ((const char *)e);
109
+ yajl_free_error (m_handle, e);
108
110
return false ;
109
111
}
110
112
0 commit comments