CustomData: don't calloc when duplicating layers

This commit is contained in:
Campbell Barton 2015-03-07 03:05:38 +11:00
parent 56f794fce6
commit 42c7200248
1 changed files with 7 additions and 1 deletions

View File

@ -1810,7 +1810,13 @@ static CustomDataLayer *customData_add_layer__internal(CustomData *data, int typ
newlayerdata = layerdata;
}
else if (size > 0) {
newlayerdata = MEM_callocN(size, layerType_getName(type));
if (alloctype == CD_DUPLICATE && layerdata) {
newlayerdata = MEM_mallocN(size, layerType_getName(type));
}
else {
newlayerdata = MEM_callocN(size, layerType_getName(type));
}
if (!newlayerdata)
return NULL;
}