Jacek Caban (@jacek) commented about dlls/vbscript/global.c:
default:
return MAKE_VBSERROR(VBSE_TYPE_MISMATCH);
- }
- if (args_cnt == 2) {
if (V_VT(args + 1) == VT_NULL)
return MAKE_VBSERROR(VBSE_ILLEGAL_NULL_USE);
if (V_VT(args + 1) != VT_BSTR) {
hres = to_string(args + 1, &delimiter);
if (FAILED(hres))
return hres;
} else {
delimiter = V_BSTR(args + 1);
}
- } else {
delimiter = SysAllocString(L" ");
This isn't a major issue, but allocating delimiter dynamically here might be unnecessary. Consider keeping `free_delimiter` as a `BSTR` and `delimiter` as a `const WCHAR *`. In this approach, you could set delimiter to `L" "` here and leave `free_delimiter` as `NULL` for this path (only assigning it in the branch that uses `to_string`).
With this change, you wouldn’t be able to use `SysStringLen` directly on `delimiter`. However, if you move the `delimiter_len` assignment here, you can set it separately for each relevant branch.