From: Wei Liu Date: Wed, 25 May 2016 13:23:56 +0000 (+0100) Subject: xl: use xstrdup in cpurange_parse X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~1089 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=80703daf3e65779ea80073e4f091faef5e881e44;p=xen.git xl: use xstrdup in cpurange_parse This ensures buf is always valid when it is passed to strtok_r. CID: 1291936 Signed-off-by: Wei Liu Reviewed-by: Andrew Cooper Acked-by: Ian Jackson Release-acked-by: Wei Liu --- diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 03ab644cae..d8530f00b1 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;