From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH] libxlu: handle NULL pointer in xlu_cfg_destroy Date: Fri, 8 May 2015 16:00:05 +0100 Message-ID: <1431097205.2660.496.camel@citrix.com> References: <1430988866-20925-1-git-send-email-olaf@aepfle.de> <20150507092617.GB29004@zion.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20150507092617.GB29004@zion.uk.xensource.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: Olaf Hering , Stefano Stabellini , Ian Jackson , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Thu, 2015-05-07 at 10:26 +0100, Wei Liu wrote: > On Thu, May 07, 2015 at 08:54:26AM +0000, Olaf Hering wrote: > > Handle NULL pointer passed to xlu_cfg_destroy. libvirt calls it in its > > libxlDriverConfigDispose function. If the XLU_Config was not initialized > > yet for some reason a crash would occour on cleanup. "occur" > > Avoid the crash just like libxl_ctx_free and xtl_logger_destroy do when > > called from the same context. > > > > Signed-off-by: Olaf Hering > > Cc: Ian Jackson > > Cc: Stefano Stabellini > > Cc: Ian Campbell > > Cc: Wei Liu > > Acked-by: Wei Liu Applied, fixing the typo. > > --- > > > > Not sure if this is correct, or if libvirt should call this function > > only if cfg is valid. > > > > If this patch gets applied I suggest to apply this also to maintained > > trees. > > > > > > tools/libxl/libxlu_cfg.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/tools/libxl/libxlu_cfg.c b/tools/libxl/libxlu_cfg.c > > index 0a59b52..1d70909 100644 > > --- a/tools/libxl/libxlu_cfg.c > > +++ b/tools/libxl/libxlu_cfg.c > > @@ -159,6 +159,7 @@ void xlu__cfg_set_free(XLU_ConfigSetting *set) { > > void xlu_cfg_destroy(XLU_Config *cfg) { > > XLU_ConfigSetting *set, *set_next; > > > > + if (!cfg) return; > > for (set= cfg->settings; > > set; > > set= set_next) {