From 502689847b86be5619da7134646d55a1ac322a2c Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 4 Apr 2008 15:01:53 +1030 Subject: [PATCH] Xi: ALLOC_COPY_CLASS_IF should only alloc if to->field doesn't exist. --- Xi/exevents.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Xi/exevents.c b/Xi/exevents.c index b2403bc11..c16b0c888 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -363,9 +363,12 @@ DeepCopyDeviceClasses(DeviceIntPtr from, DeviceIntPtr to) #define ALLOC_COPY_CLASS_IF(field, type) \ if (from->field)\ { \ - to->field = xcalloc(1, sizeof(type)); \ if (!to->field) \ + { \ + to->field = xcalloc(1, sizeof(type)); \ + if (!to->field) \ FatalError("[Xi] no memory for class shift.\n"); \ + } \ memcpy(to->field, from->field, sizeof(type)); \ }