From 50de0e0807c27a660ace9550018e7d10b3ed6b5a Mon Sep 17 00:00:00 2001 From: John Ferlan Date: Thu, 28 Feb 2013 09:46:34 -0500 Subject: [PATCH] libxl_conf: Resolve Coverity issue with call to regcomp() --- src/libxl/libxl_conf.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 4ce5deceee..b208dd8fb1 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -769,10 +769,19 @@ error: virCapsPtr libxlMakeCapabilities(libxl_ctx *ctx) { + int err; libxl_physinfo phy_info; const libxl_version_info *ver_info; - regcomp(&xen_cap_rec, xen_cap_re, REG_EXTENDED); + err = regcomp(&xen_cap_rec, xen_cap_re, REG_EXTENDED); + if (err != 0) { + char error[100]; + regerror(err, &xen_cap_rec, error, sizeof(error)); + regfree(&xen_cap_rec); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to compile regex %s"), error); + return NULL; + } if (libxl_get_physinfo(ctx, &phy_info) != 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s",