// Set up a shell of a spoof detector, with empty data.
SpoofData *newSpoofData = new SpoofData(*status);
+
+ if (newSpoofData == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return NULL;
+ }
+
+ if (U_FAILURE(*status)) {
+ delete newSpoofData;
+ return NULL;
+ }
SpoofImpl *This = new SpoofImpl(newSpoofData, *status);
+ if (This == NULL) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ delete newSpoofData; // explicit delete as the destructor for SpoofImpl won't be called.
+ return NULL;
+ }
+
+ if (U_FAILURE(*status)) {
+ delete This; // no delete for newSpoofData, as the SpoofImpl destructor will delete it.
+ return NULL;
+ }
+
// Compile the binary data from the source (text) format.
ConfusabledataBuilder::buildConfusableData(This, confusables, confusablesLen, errorType, pe, *status);