zmike pushed a commit to branch efl-1.22.

http://git.enlightenment.org/core/efl.git/commit/?id=6b7a9dc4209cbad24bdb464f4322f92e1cdbef6c

commit 6b7a9dc4209cbad24bdb464f4322f92e1cdbef6c
Author: Vincent Torri <[email protected]>
Date:   Tue Apr 30 09:23:38 2019 +0100

    eina_unicode: return NULL if allocation fails
    
    Reviewers: cedric
    
    Subscribers: #reviewers, #committers
    
    Tags: #efl
    
    Differential Revision: https://phab.enlightenment.org/D8785
---
 src/lib/eina/eina_unicode.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/lib/eina/eina_unicode.c b/src/lib/eina/eina_unicode.c
index adec87a477..0bb70ffae9 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;

-- 


Reply via email to