From 82f0be9a3217eb13d70b15c014f56009297d593b Mon Sep 17 00:00:00 2001 From: Minchul Lee Date: Mon, 8 May 2017 15:39:21 +0200 Subject: [PATCH] edje: null checking the return value of a function eina_mempool_malloc Summary: The return value of the function eina_mempool_malloc was dereferenced without checking. I added the checking code similar to the other codes. @fix Reviewers: raster, cedric, jpeg, herdsman, woohyun, stefan_schmidt Subscribers: stefan_schmidt Differential Revision: https://phab.enlightenment.org/D4855 --- src/lib/edje/edje_calc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c index 37163c3a14..ca3f851a1d 100644 --- a/src/lib/edje/edje_calc.c +++ b/src/lib/edje/edje_calc.c @@ -770,7 +770,8 @@ _edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, const char *d1, doubl { ep->param2 = eina_mempool_malloc(_edje_real_part_state_mp, sizeof(Edje_Real_Part_State)); - memset(ep->param2, 0, sizeof(Edje_Real_Part_State)); + if (ep->param2) + memset(ep->param2, 0, sizeof(Edje_Real_Part_State)); } else if (ep->part->type == EDJE_PART_TYPE_EXTERNAL) { @@ -779,7 +780,8 @@ _edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, const char *d1, doubl _edje_external_parsed_params_free(ep->typedata.swallow->swallowed_object, ep->param2->external_params); } - ep->param2->external_params = NULL; + if (ep->param2) + ep->param2->external_params = NULL; } else if (ep->param2)