From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH 8/9] xl: fix main_cpupoolcreate Date: Mon, 13 Jul 2015 11:11:57 +0100 Message-ID: <1436782317.7019.71.camel@citrix.com> References: <1436551257-28887-1-git-send-email-wei.liu2@citrix.com> <1436551257-28887-9-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.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZEaiR-0008Dr-PQ for xen-devel@lists.xenproject.org; Mon, 13 Jul 2015 10:12:03 +0000 In-Reply-To: <1436551257-28887-9-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: Wei Liu Cc: Xen-devel , Ian Jackson , Andrew Cooper List-Id: xen-devel@lists.xenproject.org On Fri, 2015-07-10 at 19:00 +0100, Wei Liu wrote: > Don't dereference extra_config if it's NULL. Don't leak extra_config in > the end. Subject should be more descriptive. "xl: correct handling of extra_config in main_cpupoolcreate" perhaps? (It's a lot easier to write non-vague messages for patches which only do one thing) > Signed-off-by: Wei Liu > --- > tools/libxl/xl_cmdimpl.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c > index 971209c..d44eb4b 100644 > --- a/tools/libxl/xl_cmdimpl.c > +++ b/tools/libxl/xl_cmdimpl.c > @@ -7228,7 +7228,7 @@ int main_cpupoolcreate(int argc, char **argv) > else > config_src="command line"; > > - if (strlen(extra_config)) { > + if (extra_config && strlen(extra_config)) { > if (config_len > INT_MAX - (strlen(extra_config) + 2)) { > fprintf(stderr, "Failed to attach extra configration\n"); There's a typo in this line of context... > goto out; > @@ -7365,6 +7365,7 @@ out_cfg: > out: > free(name); > free(config_data); > + free(extra_config); > return rc; > } >