c
char* utf8 = safe_alloc(*pLength * sizeof(WCHAR));
if (!utf8) {
    // Handle error or return an error code
}
ConvertWCharNToUtf8(wchar, *pLength, utf8, &utf8_len);
