[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v3 03/10] libxl: make libxl__strdup handle NULL
Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- tools/libxl/libxl_internal.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/libxl/libxl_internal.c b/tools/libxl/libxl_internal.c index 24a0901..48d58f2 100644 --- a/tools/libxl/libxl_internal.c +++ b/tools/libxl/libxl_internal.c @@ -161,7 +161,11 @@ char *libxl__sprintf(libxl__gc *gc, const char *fmt, ...) char *libxl__strdup(libxl__gc *gc, const char *c) { - char *s = strdup(c); + char *s; + + if (!c) return NULL; + + s = strdup(c); if (!s) libxl__alloc_failed(CTX, __func__, strlen(c), 1); -- 1.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |