utf8_to_ucs2() should check for malloc failure

utf8_to_ucs2() is calling malloc() without checking the result.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D13933
This commit is contained in:
Toomas Soome 2018-01-16 20:35:54 +00:00
parent a6f9024f20
commit 981887b970
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=328061

View File

@ -139,6 +139,8 @@ utf8_to_ucs2(const char *name, efi_char **nmp, size_t *len)
sz = strlen(name) * 2 + 2;
if (*nmp == NULL)
*nmp = malloc(sz);
if (*nmp == NULL)
return (ENOMEM);
nm = *nmp;
*len = sz;