From: Vincent Torri Date: Tue, 30 Apr 2019 08:23:38 +0000 (+0100) Subject: eina_unicode: return NULL if allocation fails X-Git-Tag: accepted/tizen/unified/20190509.041000~90 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1fc7db85aed82f77dc1871ba17f0394a951a1218;p=platform%2Fupstream%2Fefl.git eina_unicode: return NULL if allocation fails Reviewers: cedric Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8785 --- diff --git a/src/lib/eina/eina_unicode.c b/src/lib/eina/eina_unicode.c index adec87a..0bb70ff 100644 --- a/src/lib/eina/eina_unicode.c +++ b/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;