Xi: ALLOC_COPY_CLASS_IF should only alloc if to->field doesn't exist.
This commit is contained in:
parent
035b1b6995
commit
502689847b
|
@ -363,9 +363,12 @@ DeepCopyDeviceClasses(DeviceIntPtr from, DeviceIntPtr to)
|
||||||
#define ALLOC_COPY_CLASS_IF(field, type) \
|
#define ALLOC_COPY_CLASS_IF(field, type) \
|
||||||
if (from->field)\
|
if (from->field)\
|
||||||
{ \
|
{ \
|
||||||
to->field = xcalloc(1, sizeof(type)); \
|
|
||||||
if (!to->field) \
|
if (!to->field) \
|
||||||
|
{ \
|
||||||
|
to->field = xcalloc(1, sizeof(type)); \
|
||||||
|
if (!to->field) \
|
||||||
FatalError("[Xi] no memory for class shift.\n"); \
|
FatalError("[Xi] no memory for class shift.\n"); \
|
||||||
|
} \
|
||||||
memcpy(to->field, from->field, sizeof(type)); \
|
memcpy(to->field, from->field, sizeof(type)); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user