From: Wei Liu Subject: [PATCH for-4.6 05/13] xl: check json string is not null before printing in create_domain Date: Thu, 23 Jul 2015 08:59:06 +0100 Message-ID: <1437638354-14216-6-git-send-email-wei.liu2@citrix.com> References: <1437638354-14216-1-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZIBPX-0004xb-FR for xen-devel@lists.xenproject.org; Thu, 23 Jul 2015 07:59:23 +0000 In-Reply-To: <1437638354-14216-1-git-send-email-wei.liu2@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Xen-devel Cc: Wei Liu , Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org Signed-off-by: Wei Liu --- tools/libxl/xl_cmdimpl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index bfd8e59..fc61650 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -2763,6 +2763,11 @@ static uint32_t create_domain(struct domain_create *dom_info) printf_info_sexp(-1, &d_config, cfg_print_fh); } else { char *json = libxl_domain_config_to_json(ctx, &d_config); + if (!json) { + fprintf(stderr, + "Failed to convert domain configuration to JSON\n"); + exit(1); + } fputs(json, cfg_print_fh); free(json); flush_stream(cfg_print_fh); -- 1.9.1