eina_str: add null check condition in eina_memdup.
Summary: Added null check in eina_memdup function in eina_str Signed-off-by: vivek <vivek.ellur@samsung.com> Reviewers: cedric Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D1997 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
This commit is contained in:
parent
3dda07dbce
commit
2ae90fd1ff
|
@ -668,8 +668,12 @@ eina_memdup(unsigned char *mem, size_t size, Eina_Bool terminate)
|
|||
{
|
||||
unsigned char *ret;
|
||||
|
||||
if (!mem) return NULL;
|
||||
|
||||
terminate = !!terminate;
|
||||
ret = malloc(size + terminate);
|
||||
if (!ret) return NULL;
|
||||
|
||||
memcpy(ret, mem, size);
|
||||
if (terminate)
|
||||
ret[size] = 0;
|
||||
|
|
Loading…
Reference in New Issue