This ensures buf is always valid when it is passed to strtok_r. CID: 1291936
Signed-off-by: Wei Liu <wei.l...@citrix.com> --- Cc: Ian Jackson <ian.jack...@eu.citrix.com> This is a backport candidate. --- tools/libxl/xl_cmdimpl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 03ab644..d8530f0 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -847,7 +847,7 @@ static int update_cpumap_range(const char *str, libxl_bitmap *cpumap) */ static int cpurange_parse(const char *cpu, libxl_bitmap *cpumap) { - char *ptr, *saveptr = NULL, *buf = strdup(cpu); + char *ptr, *saveptr = NULL, *buf = xstrdup(cpu); int rc = 0; for (ptr = strtok_r(buf, ",", &saveptr); ptr; -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel