# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1201034878 28800
# Node ID d4fb7d17d93660af5e367dfed0a11d35007aea39
# Parent 84f80a8040eb29109d0fce50b582582527c2e50e
Make virt_device_dup() not crash the CIMOM if a field is NULL
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r 84f80a8040eb -r d4fb7d17d936 libxkutil/device_parsing.c
--- a/libxkutil/device_parsing.c Tue Jan 22 11:22:14 2008 -0800
+++ b/libxkutil/device_parsing.c Tue Jan 22 12:47:58 2008 -0800
@@ -519,7 +519,10 @@ static int parse_devices(const char *xml
return count;
}
-#define DUP_FIELD(d, s, f) ((d)->f = strdup((s)->f))
+#define DUP_FIELD(d, s, f) do { \
+ if ((s)->f != NULL) \
+ (d)->f = strdup((s)->f); \
+ } while (0);
struct virt_device *virt_device_dup(struct virt_device *_dev)
{