On Wed Feb 8 12:12:04 2023 +0000, Jacek Caban wrote:
This is fine for the leak, but it would be even better to avoid extra string copy. We don't really need `VariantCopyInd` in this case, we could just set data[i] variant directly and get rid of var variable.
Something like this?
``` for (i = 0; i < count; i++) { V_VT(&data[i]) = VT_BSTR; V_BSTR(&data[i]) = SysAllocStringLen(string + start, indices[i] - start);
if (!V_BSTR(&data[i])) { hres = E_OUTOFMEMORY;
SafeArrayUnaccessData(sa); goto error; } start = indices[i]+delimiterlen; } ```