summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaehyun Cho <jae_hyun.cho@samsung.com>2015-06-15 14:56:42 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2015-06-15 14:56:42 +0900
commit4a3ba2e2307cd57f89c5520ac74ae7251c7a6c0f (patch)
treea51eb6b271a6f86d6f564dbb644a18a4d4b3d9a8
parent7291772fabd7cfa76bbc0c414177d43d1541de00 (diff)
layout: Add NULL check for ELM_NEW memory allocation.
-rw-r--r--src/lib/elm_layout.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/lib/elm_layout.c b/src/lib/elm_layout.c
index f49d158b4..2ca1274b4 100644
--- a/src/lib/elm_layout.c
+++ b/src/lib/elm_layout.c
@@ -1004,10 +1004,18 @@ _elm_layout_elm_container_content_set(Eo *obj, Elm_Layout_Smart_Data *sd, const
1004 (wd->resize_obj, part, content)) 1004 (wd->resize_obj, part, content))
1005 { 1005 {
1006 ERR("could not swallow %p into part '%s'", content, part); 1006 ERR("could not swallow %p into part '%s'", content, part);
1007 elm_widget_sub_object_del(obj, content);
1007 return EINA_FALSE; 1008 return EINA_FALSE;
1008 } 1009 }
1009 1010
1010 sub_d = ELM_NEW(Elm_Layout_Sub_Object_Data); 1011 sub_d = ELM_NEW(Elm_Layout_Sub_Object_Data);
1012 if (!sub_d)
1013 {
1014 ERR("failed to allocate memory!");
1015 edje_object_part_unswallow(wd->resize_obj, part);
1016 elm_widget_sub_object_del(obj, content);
1017 return EINA_FALSE;
1018 }
1011 sub_d->type = SWALLOW; 1019 sub_d->type = SWALLOW;
1012 sub_d->part = eina_stringshare_add(part); 1020 sub_d->part = eina_stringshare_add(part);
1013 sub_d->obj = content; 1021 sub_d->obj = content;
@@ -1213,6 +1221,13 @@ _elm_layout_box_append(Eo *obj, Elm_Layout_Smart_Data *sd, const char *part, Eva
1213 } 1221 }
1214 1222
1215 sub_d = ELM_NEW(Elm_Layout_Sub_Object_Data); 1223 sub_d = ELM_NEW(Elm_Layout_Sub_Object_Data);
1224 if (!sub_d)
1225 {
1226 ERR("failed to allocate memory!");
1227 elm_widget_sub_object_del(obj, child);
1228 edje_object_part_box_remove(wd->resize_obj, part, child);
1229 return EINA_FALSE;
1230 }
1216 sub_d->type = BOX_APPEND; 1231 sub_d->type = BOX_APPEND;
1217 sub_d->part = eina_stringshare_add(part); 1232 sub_d->part = eina_stringshare_add(part);
1218 sub_d->obj = child; 1233 sub_d->obj = child;
@@ -1245,6 +1260,13 @@ _elm_layout_box_prepend(Eo *obj, Elm_Layout_Smart_Data *sd, const char *part, Ev
1245 } 1260 }
1246 1261
1247 sub_d = ELM_NEW(Elm_Layout_Sub_Object_Data); 1262 sub_d = ELM_NEW(Elm_Layout_Sub_Object_Data);
1263 if (!sub_d)
1264 {
1265 ERR("failed to allocate memory!");
1266 elm_widget_sub_object_del(obj, child);
1267 edje_object_part_box_remove(wd->resize_obj, part, child);
1268 return EINA_FALSE;
1269 }
1248 sub_d->type = BOX_PREPEND; 1270 sub_d->type = BOX_PREPEND;
1249 sub_d->part = eina_stringshare_add(part); 1271 sub_d->part = eina_stringshare_add(part);
1250 sub_d->obj = child; 1272 sub_d->obj = child;
@@ -1278,6 +1300,13 @@ _elm_layout_box_insert_before(Eo *obj, Elm_Layout_Smart_Data *sd, const char *pa
1278 } 1300 }
1279 1301
1280 sub_d = ELM_NEW(Elm_Layout_Sub_Object_Data); 1302 sub_d = ELM_NEW(Elm_Layout_Sub_Object_Data);
1303 if (!sub_d)
1304 {
1305 ERR("failed to allocate memory!");
1306 elm_widget_sub_object_del(obj, child);
1307 edje_object_part_box_remove(wd->resize_obj, part, child);
1308 return EINA_FALSE;
1309 }
1281 sub_d->type = BOX_INSERT_BEFORE; 1310 sub_d->type = BOX_INSERT_BEFORE;
1282 sub_d->part = eina_stringshare_add(part); 1311 sub_d->part = eina_stringshare_add(part);
1283 sub_d->obj = child; 1312 sub_d->obj = child;
@@ -1314,6 +1343,13 @@ _elm_layout_box_insert_at(Eo *obj, Elm_Layout_Smart_Data *sd, const char *part,
1314 } 1343 }
1315 1344
1316 sub_d = ELM_NEW(Elm_Layout_Sub_Object_Data); 1345 sub_d = ELM_NEW(Elm_Layout_Sub_Object_Data);
1346 if (!sub_d)
1347 {
1348 ERR("failed to allocate memory!");
1349 elm_widget_sub_object_del(obj, child);
1350 edje_object_part_box_remove(wd->resize_obj, part, child);
1351 return EINA_FALSE;
1352 }
1317 sub_d->type = BOX_INSERT_AT; 1353 sub_d->type = BOX_INSERT_AT;
1318 sub_d->part = eina_stringshare_add(part); 1354 sub_d->part = eina_stringshare_add(part);
1319 sub_d->obj = child; 1355 sub_d->obj = child;
@@ -1401,6 +1437,13 @@ _elm_layout_table_pack(Eo *obj, Elm_Layout_Smart_Data *sd, const char *part, Eva
1401 } 1437 }
1402 1438
1403 sub_d = ELM_NEW(Elm_Layout_Sub_Object_Data); 1439 sub_d = ELM_NEW(Elm_Layout_Sub_Object_Data);
1440 if (!sub_d)
1441 {
1442 ERR("failed to allocate memory!");
1443 elm_widget_sub_object_del(obj, child);
1444 edje_object_part_table_unpack(wd->resize_obj, part, child);
1445 return EINA_FALSE;
1446 }
1404 sub_d->type = TABLE_PACK; 1447 sub_d->type = TABLE_PACK;
1405 sub_d->part = eina_stringshare_add(part); 1448 sub_d->part = eina_stringshare_add(part);
1406 sub_d->obj = child; 1449 sub_d->obj = child;