@@ -87,10 +87,11 @@ bool JSON::processChunk(const char *buf, unsigned int size, std::string *err) {
8787 m_status = yajl_parse (m_handle,
8888 (const unsigned char *)buf, size);
8989 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 ,
9191 (const unsigned char *)buf, size);
9292 /* We need to free the yajl error message later, how to do this? */
9393 err->assign ((const char *)e);
94+ yajl_free_error (m_handle, e);
9495 return false ;
9596 }
9697
@@ -102,9 +103,10 @@ bool JSON::complete(std::string *err) {
102103 /* Wrap up the parsing process */
103104 m_status = yajl_complete_parse (m_handle);
104105 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 );
106107 /* We need to free the yajl error message later, how to do this? */
107108 err->assign ((const char *)e);
109+ yajl_free_error (m_handle, e);
108110 return false ;
109111 }
110112
0 commit comments