Xi: ALLOC_COPY_CLASS_IF should only alloc if to->field doesn't exist.
This commit is contained in:
parent
035b1b6995
commit
502689847b
|
@ -362,10 +362,13 @@ DeepCopyDeviceClasses(DeviceIntPtr from, DeviceIntPtr to)
|
|||
{
|
||||
#define ALLOC_COPY_CLASS_IF(field, type) \
|
||||
if (from->field)\
|
||||
{ \
|
||||
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)); \
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user