diff --git a/src/modsecurity.cc b/src/modsecurity.cc index 867b6968..2d8b03d4 100644 --- a/src/modsecurity.cc +++ b/src/modsecurity.cc @@ -417,9 +417,8 @@ int ModSecurity::processContentOffset(const char *content, size_t len, yajl_gen_map_close(g); - yajl_gen_array_close(g); - yajl_gen_map_close(g); + yajl_gen_array_close(g); yajl_gen_map_close(g); @@ -428,6 +427,7 @@ int ModSecurity::processContentOffset(const char *content, size_t len, json->assign(reinterpret_cast(buf), jsonSize); json->append("\n"); + yajl_gen_clear(g); yajl_gen_free(g); #else *err = strdup("Without YAJL support, we cannot generate JSON.");