eina_unicode: return NULL if allocation fails

Reviewers: cedric

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8785
devs/lauromoura/pin-unpin
Vincent Torri 4 years ago committed by Carsten Haitzler (Rasterman)
parent 0fda181e0a
commit 93070e4f0f
  1. 3
      src/lib/eina/eina_unicode.c

@ -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…
Cancel
Save