vendor/libgit2/src/win32/utf-conv.c in rugged-0.22.2 vs vendor/libgit2/src/win32/utf-conv.c in rugged-0.23.0b1
- old
+ new
@@ -97,12 +97,10 @@
if (!utf16_size) {
git__set_errno();
return -1;
}
- *dest = git__malloc(utf16_size * sizeof(wchar_t));
-
- if (!*dest) {
+ if (!(*dest = git__mallocarray(utf16_size, sizeof(wchar_t)))) {
errno = ENOMEM;
return -1;
}
utf16_size = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, src, -1, *dest, utf16_size);