summaryrefslogtreecommitdiff
path: root/src/benchmarks
diff options
context:
space:
mode:
authorShinwoo Kim <cinoo.kim@samsung.com>2019-09-03 12:04:16 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-09-03 12:21:27 -0400
commit1d96fc92023c37af76f4c277c917911f059ae220 (patch)
tree5c1d449e639955c02359461e9c71de7bdf1f35a0 /src/benchmarks
parentf306d2b879688e952db3ab955ddc73d65a7f9fee (diff)
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
Diffstat (limited to 'src/benchmarks')
-rw-r--r--src/benchmarks/eina/ecore_strings.c1
-rw-r--r--src/benchmarks/eina/evas_mempool.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/src/benchmarks/eina/ecore_strings.c b/src/benchmarks/eina/ecore_strings.c
index 15deae6..e562352 100644
--- a/src/benchmarks/eina/ecore_strings.c
+++ b/src/benchmarks/eina/ecore_strings.c
@@ -83,6 +83,7 @@ ecore_string_instance(const char *string)
83 83
84 str = 84 str =
85 (Ecore_String *)malloc(sizeof(Ecore_String) + length * sizeof(char)); 85 (Ecore_String *)malloc(sizeof(Ecore_String) + length * sizeof(char));
86 if (!str) return NULL;
86 87
87 str->string = (char *)(str + 1); 88 str->string = (char *)(str + 1);
88 str->references = 0; 89 str->references = 0;
diff --git a/src/benchmarks/eina/evas_mempool.c b/src/benchmarks/eina/evas_mempool.c
index 40df42f..156a36f 100644
--- a/src/benchmarks/eina/evas_mempool.c
+++ b/src/benchmarks/eina/evas_mempool.c
@@ -40,6 +40,7 @@ _evas_mp_pool_new(Evas_Mempool *pool)
40 item_alloc = 40 item_alloc =
41 ((pool->item_size + sizeof(void *) - 1) / sizeof(void *)) * sizeof(void *); 41 ((pool->item_size + sizeof(void *) - 1) / sizeof(void *)) * sizeof(void *);
42 p = malloc(sizeof(Pool) + (pool->pool_size * item_alloc)); 42 p = malloc(sizeof(Pool) + (pool->pool_size * item_alloc));
43 if (!p) return NULL;
43 ptr = (void **)(((unsigned char *)p) + sizeof(Pool)); 44 ptr = (void **)(((unsigned char *)p) + sizeof(Pool));
44 p->usage = 0; 45 p->usage = 0;
45 p->base = ptr; 46 p->base = ptr;