From: Anthony PERARD Subject: [PATCH V2 02/11] libxl_json, Check the parser status before to call parse_complete Date: Thu, 20 Oct 2011 18:59:24 +0100 Message-ID: <1319133573-25891-3-git-send-email-anthony.perard@citrix.com> References: <1319133573-25891-1-git-send-email-anthony.perard@citrix.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: In-Reply-To: <1319133573-25891-1-git-send-email-anthony.perard@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Xen Devel Cc: Anthony PERARD , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org Signed-off-by: Anthony PERARD --- tools/libxl/libxl_json.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/tools/libxl/libxl_json.c b/tools/libxl/libxl_json.c index 11f65fc..c743114 100644 --- a/tools/libxl/libxl_json.c +++ b/tools/libxl/libxl_json.c @@ -744,7 +744,9 @@ libxl__json_object *libxl__json_parse(libxl__gc *gc, const char *s) yajl_ctx.hand = yajl_alloc(&callbacks, &cfg, NULL, &yajl_ctx); } status = yajl_parse(yajl_ctx.hand, (const unsigned char *)s, strlen(s)); - status = yajl_parse_complete(yajl_ctx.hand); + if (status == yajl_status_ok) { + status = yajl_parse_complete(yajl_ctx.hand); + } if (status == yajl_status_ok) { libxl__json_object *o = yajl_ctx.head; -- Anthony PERARD