forked from enlightenment/efl
eina_unicode: return NULL if allocation fails
Reviewers: cedric Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8785
This commit is contained in:
parent
0fda181e0a
commit
93070e4f0f
|
@ -116,6 +116,9 @@ eina_unicode_strndup(const Eina_Unicode *text, size_t n)
|
|||
EINA_SAFETY_ON_NULL_RETURN_VAL(text, NULL);
|
||||
|
||||
ustr = malloc((n + 1) * sizeof(Eina_Unicode));
|
||||
if (!ustr)
|
||||
return NULL;
|
||||
|
||||
memcpy(ustr, text, n * sizeof(Eina_Unicode));
|
||||
ustr[n] = 0;
|
||||
return ustr;
|
||||
|
|
Loading…
Reference in New Issue