summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaeun Choi <jaeun12.choi@samsung.com>2019-02-14 16:08:33 +0900
committerJaeun Choi <jaeun12.choi@samsung.com>2019-02-14 16:10:15 +0900
commite39c71085801ca5cb73ff74815a4a203acd268d6 (patch)
tree2c784207f552af798bfe099b48348d9a240e9a16
parentdea75d0f3283f31751e577925e81758836c10b70 (diff)
test/efl_ui_pager: add NULL checking after calloc() function
-rw-r--r--src/bin/elementary/test_ui_pager.c19
-rw-r--r--src/bin/elementary/test_ui_pager_scroll.c19
2 files changed, 38 insertions, 0 deletions
diff --git a/src/bin/elementary/test_ui_pager.c b/src/bin/elementary/test_ui_pager.c
index ca2cec593b..f864a430c4 100644
--- a/src/bin/elementary/test_ui_pager.c
+++ b/src/bin/elementary/test_ui_pager.c
@@ -361,6 +361,8 @@ static void page_size_cb(void *data,
361 efl_pack_end(inbox, efl_added)); 361 efl_pack_end(inbox, efl_added));
362 362
363 size_params = calloc(1, sizeof(Size_Params)); 363 size_params = calloc(1, sizeof(Size_Params));
364 if (!size_params) return;
365
364 size_params->slider = sl; 366 size_params->slider = sl;
365 size_params->pager = params->pager; 367 size_params->pager = params->pager;
366 size_params->params = params; 368 size_params->params = params;
@@ -400,6 +402,8 @@ static void page_size_cb(void *data,
400 efl_pack_end(inbox, efl_added)); 402 efl_pack_end(inbox, efl_added));
401 403
402 size_params = calloc(1, sizeof(Size_Params)); 404 size_params = calloc(1, sizeof(Size_Params));
405 if (!size_params) return;
406
403 size_params->slider = sl; 407 size_params->slider = sl;
404 size_params->pager = params->pager; 408 size_params->pager = params->pager;
405 size_params->params = params; 409 size_params->params = params;
@@ -456,6 +460,8 @@ static void pack_cb(void *data,
456 460
457 // Pack Begin 461 // Pack Begin
458 pack_param = calloc(1, sizeof(Pack_Params)); 462 pack_param = calloc(1, sizeof(Pack_Params));
463 if (!pack_param) return;
464
459 pack_param->pager = pager; 465 pack_param->pager = pager;
460 pack_param->pack_sp = sp1; 466 pack_param->pack_sp = sp1;
461 pack_param->unpack_sp = sp2; 467 pack_param->unpack_sp = sp2;
@@ -472,6 +478,8 @@ static void pack_cb(void *data,
472 478
473 // Pack End 479 // Pack End
474 pack_param = calloc(1, sizeof(Pack_Params)); 480 pack_param = calloc(1, sizeof(Pack_Params));
481 if (!pack_param) return;
482
475 pack_param->pager = pager; 483 pack_param->pager = pager;
476 pack_param->pack_sp = sp1; 484 pack_param->pack_sp = sp1;
477 pack_param->unpack_sp = sp2; 485 pack_param->unpack_sp = sp2;
@@ -488,6 +496,8 @@ static void pack_cb(void *data,
488 496
489 // Pack Before 497 // Pack Before
490 pack_param = calloc(1, sizeof(Pack_Params)); 498 pack_param = calloc(1, sizeof(Pack_Params));
499 if (!pack_param) return;
500
491 pack_param->pager = pager; 501 pack_param->pager = pager;
492 pack_param->pack_sp = sp1; 502 pack_param->pack_sp = sp1;
493 pack_param->unpack_sp = sp2; 503 pack_param->unpack_sp = sp2;
@@ -504,6 +514,8 @@ static void pack_cb(void *data,
504 514
505 // Pack After 515 // Pack After
506 pack_param = calloc(1, sizeof(Pack_Params)); 516 pack_param = calloc(1, sizeof(Pack_Params));
517 if (!pack_param) return;
518
507 pack_param->pager = pager; 519 pack_param->pager = pager;
508 pack_param->pack_sp = sp1; 520 pack_param->pack_sp = sp1;
509 pack_param->unpack_sp = sp2; 521 pack_param->unpack_sp = sp2;
@@ -520,6 +532,8 @@ static void pack_cb(void *data,
520 532
521 // Pack At 533 // Pack At
522 pack_param = calloc(1, sizeof(Pack_Params)); 534 pack_param = calloc(1, sizeof(Pack_Params));
535 if (!pack_param) return;
536
523 pack_param->pager = pager; 537 pack_param->pager = pager;
524 pack_param->pack_sp = sp1; 538 pack_param->pack_sp = sp1;
525 pack_param->unpack_sp = sp2; 539 pack_param->unpack_sp = sp2;
@@ -539,6 +553,8 @@ static void pack_cb(void *data,
539 553
540 // Unpack At 554 // Unpack At
541 pack_param = calloc(1, sizeof(Pack_Params)); 555 pack_param = calloc(1, sizeof(Pack_Params));
556 if (!pack_param) return;
557
542 pack_param->pager = pager; 558 pack_param->pager = pager;
543 pack_param->pack_sp = sp1; 559 pack_param->pack_sp = sp1;
544 pack_param->unpack_sp = sp2; 560 pack_param->unpack_sp = sp2;
@@ -577,6 +593,7 @@ static void current_page_cb(void *data,
577 Eo *pager = params->pager; 593 Eo *pager = params->pager;
578 Eo *btn, *box, *sp; 594 Eo *btn, *box, *sp;
579 Page_Set_Params *psp = calloc(1, sizeof(Page_Set_Params)); 595 Page_Set_Params *psp = calloc(1, sizeof(Page_Set_Params));
596 if (!psp) return;
580 597
581 btn = efl_add(EFL_UI_BUTTON_CLASS, navi, 598 btn = efl_add(EFL_UI_BUTTON_CLASS, navi,
582 efl_text_set(efl_added, "Back"), 599 efl_text_set(efl_added, "Back"),
@@ -699,6 +716,8 @@ void test_ui_pager(void *data EINA_UNUSED,
699 efl_content_set(efl_part(layout, "next_btn"), efl_added)); 716 efl_content_set(efl_part(layout, "next_btn"), efl_added));
700 717
701 params = calloc(1, sizeof(Params)); 718 params = calloc(1, sizeof(Params));
719 if (!params) return;
720
702 params->navi = navi; 721 params->navi = navi;
703 params->pager = pager; 722 params->pager = pager;
704 params->indicator = NULL; 723 params->indicator = NULL;
diff --git a/src/bin/elementary/test_ui_pager_scroll.c b/src/bin/elementary/test_ui_pager_scroll.c
index b336f11cd7..99a6fc9146 100644
--- a/src/bin/elementary/test_ui_pager_scroll.c
+++ b/src/bin/elementary/test_ui_pager_scroll.c
@@ -417,6 +417,8 @@ static void page_size_cb(void *data,
417 efl_pack_end(inbox, efl_added)); 417 efl_pack_end(inbox, efl_added));
418 418
419 size_params = calloc(1, sizeof(Size_Params)); 419 size_params = calloc(1, sizeof(Size_Params));
420 if (!size_params) return;
421
420 size_params->slider = sl; 422 size_params->slider = sl;
421 size_params->pager = params->pager; 423 size_params->pager = params->pager;
422 size_params->params = params; 424 size_params->params = params;
@@ -456,6 +458,8 @@ static void page_size_cb(void *data,
456 efl_pack_end(inbox, efl_added)); 458 efl_pack_end(inbox, efl_added));
457 459
458 size_params = calloc(1, sizeof(Size_Params)); 460 size_params = calloc(1, sizeof(Size_Params));
461 if (!size_params) return;
462
459 size_params->slider = sl; 463 size_params->slider = sl;
460 size_params->pager = params->pager; 464 size_params->pager = params->pager;
461 size_params->params = params; 465 size_params->params = params;
@@ -570,6 +574,8 @@ static void pack_cb(void *data,
570 574
571 // Pack Begin 575 // Pack Begin
572 pack_param = calloc(1, sizeof(Pack_Params)); 576 pack_param = calloc(1, sizeof(Pack_Params));
577 if (!pack_param) return;
578
573 pack_param->pager = pager; 579 pack_param->pager = pager;
574 pack_param->pack_sp = sp1; 580 pack_param->pack_sp = sp1;
575 pack_param->unpack_sp = sp2; 581 pack_param->unpack_sp = sp2;
@@ -586,6 +592,8 @@ static void pack_cb(void *data,
586 592
587 // Pack End 593 // Pack End
588 pack_param = calloc(1, sizeof(Pack_Params)); 594 pack_param = calloc(1, sizeof(Pack_Params));
595 if (!pack_param) return;
596
589 pack_param->pager = pager; 597 pack_param->pager = pager;
590 pack_param->pack_sp = sp1; 598 pack_param->pack_sp = sp1;
591 pack_param->unpack_sp = sp2; 599 pack_param->unpack_sp = sp2;
@@ -602,6 +610,8 @@ static void pack_cb(void *data,
602 610
603 // Pack Before 611 // Pack Before
604 pack_param = calloc(1, sizeof(Pack_Params)); 612 pack_param = calloc(1, sizeof(Pack_Params));
613 if (!pack_param) return;
614
605 pack_param->pager = pager; 615 pack_param->pager = pager;
606 pack_param->pack_sp = sp1; 616 pack_param->pack_sp = sp1;
607 pack_param->unpack_sp = sp2; 617 pack_param->unpack_sp = sp2;
@@ -618,6 +628,8 @@ static void pack_cb(void *data,
618 628
619 // Pack After 629 // Pack After
620 pack_param = calloc(1, sizeof(Pack_Params)); 630 pack_param = calloc(1, sizeof(Pack_Params));
631 if (!pack_param) return;
632
621 pack_param->pager = pager; 633 pack_param->pager = pager;
622 pack_param->pack_sp = sp1; 634 pack_param->pack_sp = sp1;
623 pack_param->unpack_sp = sp2; 635 pack_param->unpack_sp = sp2;
@@ -634,6 +646,8 @@ static void pack_cb(void *data,
634 646
635 // Pack At 647 // Pack At
636 pack_param = calloc(1, sizeof(Pack_Params)); 648 pack_param = calloc(1, sizeof(Pack_Params));
649 if (!pack_param) return;
650
637 pack_param->pager = pager; 651 pack_param->pager = pager;
638 pack_param->pack_sp = sp1; 652 pack_param->pack_sp = sp1;
639 pack_param->unpack_sp = sp2; 653 pack_param->unpack_sp = sp2;
@@ -653,6 +667,8 @@ static void pack_cb(void *data,
653 667
654 // Unpack At 668 // Unpack At
655 pack_param = calloc(1, sizeof(Pack_Params)); 669 pack_param = calloc(1, sizeof(Pack_Params));
670 if (!pack_param) return;
671
656 pack_param->pager = pager; 672 pack_param->pager = pager;
657 pack_param->pack_sp = sp1; 673 pack_param->pack_sp = sp1;
658 pack_param->unpack_sp = sp2; 674 pack_param->unpack_sp = sp2;
@@ -691,6 +707,7 @@ static void current_page_cb(void *data,
691 Eo *pager = params->pager; 707 Eo *pager = params->pager;
692 Eo *btn, *box, *sp; 708 Eo *btn, *box, *sp;
693 Page_Set_Params *psp = calloc(1, sizeof(Page_Set_Params)); 709 Page_Set_Params *psp = calloc(1, sizeof(Page_Set_Params));
710 if (!psp) return;
694 711
695 btn = efl_add(EFL_UI_BUTTON_CLASS, navi, 712 btn = efl_add(EFL_UI_BUTTON_CLASS, navi,
696 efl_text_set(efl_added, "Back"), 713 efl_text_set(efl_added, "Back"),
@@ -884,6 +901,8 @@ void test_ui_pager_scroll(void *data EINA_UNUSED,
884 efl_ui_pager_transition_set(pager, efl_added)); 901 efl_ui_pager_transition_set(pager, efl_added));
885 902
886 params = calloc(1, sizeof(Params)); 903 params = calloc(1, sizeof(Params));
904 if (!params) return;
905
887 params->navi = navi; 906 params->navi = navi;
888 params->pager = pager; 907 params->pager = pager;
889 params->transition = NULL; 908 params->transition = NULL;