Xi: ALLOC_COPY_CLASS_IF should only alloc if to->field doesn't exist.

This commit is contained in:
Peter Hutterer 2008-04-04 15:01:53 +10:30
parent 035b1b6995
commit 502689847b

View File

@ -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)); \
}