Subject: xl: correct handling of extra_config in main_cpupoolcreate From: Wei Liu wei.liu2@citrix.com Tue Jul 14 17:41:10 2015 +0100 Date: Wed Jul 15 10:58:08 2015 +0100: Git: 705c9e12426cba82804cb578fc70785281655d94 Don't dereference extra_config if it's NULL. Don't leak extra_config in the end. Also fixed a typo in error string while I was there. Signed-off-by: Wei Liu Acked-by: Ian Jackson Index: xen-4.5.1-testing/tools/libxl/xl_cmdimpl.c =================================================================== --- xen-4.5.1-testing.orig/tools/libxl/xl_cmdimpl.c +++ xen-4.5.1-testing/tools/libxl/xl_cmdimpl.c @@ -7085,9 +7085,9 @@ int main_cpupoolcreate(int argc, char ** 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"); + fprintf(stderr, "Failed to attach extra configuration\n"); goto out; } config_data = xrealloc(config_data, @@ -7211,6 +7211,7 @@ out_cfg: out: free(name); free(config_data); + free(extra_config); return rc; }