+ /* Create new array to fit one more record */ + DWORD new_record_count = device->pick_record_count + 1; + D3DPICKRECORD* new_record_array = malloc(sizeof(*device->pick_records) * new_record_count); + if (device->pick_record_count > 0) + { + memcpy(new_record_array, device->pick_records, sizeof(*device->pick_records) * device->pick_record_count); + free(device->pick_records); + }
This was already there in v1—style issues and all—and it's the kind of thing that tends to make a reviewer's desire to look at the more complicated bits of a patch evaporate. Patch 08/13 somewhat improves on this, but of course doesn't handle e.g. realloc() failure either.