debuggers.hg

changeset 22778:b80c530dac8c

libxl: config parser: do not segfault in some error paths

In error paths, xlu__cfg_set_free can be called on NULL.
So check for that rather than segfaulting.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
author Ian Jackson <Ian.Jackson@eu.citrix.com>
date Tue Jan 11 19:28:22 2011 +0000 (2011-01-11)
parents 9ee86e8cfd78
children 0b04aea87667
files tools/libxl/libxlu_cfg.c
line diff
     1.1 --- a/tools/libxl/libxlu_cfg.c	Tue Jan 11 15:10:21 2011 +0000
     1.2 +++ b/tools/libxl/libxlu_cfg.c	Tue Jan 11 19:28:22 2011 +0000
     1.3 @@ -93,6 +93,7 @@ int xlu_cfg_readdata(XLU_Config *cfg, co
     1.4  void xlu__cfg_set_free(XLU_ConfigSetting *set) {
     1.5      int i;
     1.6  
     1.7 +    if (!set) return;
     1.8      free(set->name);
     1.9      for (i=0; i<set->nvalues; i++)
    1.10          free(set->values[i]);