forked from enlightenment/efl
eina benchmarks: remove dereference of null
Summary: A static analysis tool detects return value of malloc could be NULL and its following lines could have derefernece of NULL case. Reviewers: bu5hm4n, zmike, Hermet Reviewed By: zmike Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9812
This commit is contained in:
parent
f306d2b879
commit
1d96fc9202
|
@ -83,6 +83,7 @@ ecore_string_instance(const char *string)
|
|||
|
||||
str =
|
||||
(Ecore_String *)malloc(sizeof(Ecore_String) + length * sizeof(char));
|
||||
if (!str) return NULL;
|
||||
|
||||
str->string = (char *)(str + 1);
|
||||
str->references = 0;
|
||||
|
|
|
@ -40,6 +40,7 @@ _evas_mp_pool_new(Evas_Mempool *pool)
|
|||
item_alloc =
|
||||
((pool->item_size + sizeof(void *) - 1) / sizeof(void *)) * sizeof(void *);
|
||||
p = malloc(sizeof(Pool) + (pool->pool_size * item_alloc));
|
||||
if (!p) return NULL;
|
||||
ptr = (void **)(((unsigned char *)p) + sizeof(Pool));
|
||||
p->usage = 0;
|
||||
p->base = ptr;
|
||||
|
|
Loading…
Reference in New Issue