From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Liu Subject: [PATCH for-4.6 13/13] tools/ocaml: handle strdup failure in stub_xl_device_disk_of_vdev Date: Thu, 23 Jul 2015 08:59:14 +0100 Message-ID: <1437638354-14216-14-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 1ZIBf6-0007V1-44 for xen-devel@lists.xenproject.org; Thu, 23 Jul 2015 08:15:28 +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 , dave.scott@eu.citrix.com List-Id: xen-devel@lists.xenproject.org Signed-off-by: Wei Liu --- Cc: dave.scott@eu.citrix.com Please check if the use of caml_failwith is correct. --- tools/ocaml/libs/xl/xenlight_stubs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/ocaml/libs/xl/xenlight_stubs.c b/tools/ocaml/libs/xl/xenlight_stubs.c index 7b8d6db..dccd7ed 100644 --- a/tools/ocaml/libs/xl/xenlight_stubs.c +++ b/tools/ocaml/libs/xl/xenlight_stubs.c @@ -780,6 +780,10 @@ value stub_xl_device_disk_of_vdev(value ctx, value domid, value vdev) c_vdev = strdup(String_val(vdev)); + if (!c_vdev) { + caml_failwith("Failed to duplicate vdev string."); + } + caml_enter_blocking_section(); libxl_vdev_to_device_disk(CTX, c_domid, c_vdev, &c_disk); caml_leave_blocking_section(); -- 1.9.1