From 391db023e0601d722220cc8ecfd3747c35dfe317 Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Sat, 8 Feb 2014 09:57:55 -0800 Subject: [PATCH] Talk about error cleanup in README --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index e1b75fec..c84fd6cc 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,14 @@ The types that can be sent to the callback function are JSON_ARRAY, JSON_HASH, JSON_COMMA, and JSON_COLON. +Cleanup +------- + +If there was an error while parsing, the parser will have returned NULL before +all the containers were closed. You will probably want to call json_free() +on the root elemement of the parser, which should contain the full parse +tree so far, to avoid leaking memory. + Shutdown -------- @@ -103,6 +111,8 @@ The parser object has two fields of public interest: error is a str describing any errors found in the JSON, and line is the current line number being read from the input to make it easier to find the errors. +The root field points to the outer object of the current parse tree. + Utility function ----------------