summaryrefslogtreecommitdiff
path: root/src/lib/eina
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2019-04-30 09:23:38 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-04-30 09:24:48 +0100
commit93070e4f0f38867e1ea24cc02773146372ae4dce (patch)
tree9656bf6ac8d4c3f7de4b62e41dadd7d65899019e /src/lib/eina
parent0fda181e0aab862522ca7b9c145dd08b692b4662 (diff)
eina_unicode: return NULL if allocation fails
Reviewers: cedric Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8785
Diffstat (limited to 'src/lib/eina')
-rw-r--r--src/lib/eina/eina_unicode.c3
1 files changed, 3 insertions, 0 deletions
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)
116 EINA_SAFETY_ON_NULL_RETURN_VAL(text, NULL); 116 EINA_SAFETY_ON_NULL_RETURN_VAL(text, NULL);
117 117
118 ustr = malloc((n + 1) * sizeof(Eina_Unicode)); 118 ustr = malloc((n + 1) * sizeof(Eina_Unicode));
119 if (!ustr)
120 return NULL;
121
119 memcpy(ustr, text, n * sizeof(Eina_Unicode)); 122 memcpy(ustr, text, n * sizeof(Eina_Unicode));
120 ustr[n] = 0; 123 ustr[n] = 0;
121 return ustr; 124 return ustr;