summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorJiyoun Park <jy0703.park@samsung.com>2017-08-02 16:42:04 +0900
committerJiyoun Park <jy0703.park@samsung.com>2017-08-02 16:42:04 +0900
commitc3d8a1d9f45fe990595bad9f3ed6ea81308754e6 (patch)
treec1134407f6930c2cdc086a4edfaaf08ac9d6a17c /src/lib
parent5c8670fb2b956f0040b675311f13ab6a4008b040 (diff)
efl_ui_win: add error hanling code for malloc fail
Diffstat (limited to '')
-rw-r--r--src/lib/elementary/efl_ui_win.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c
index 47881cd3cd..63f3957dd5 100644
--- a/src/lib/elementary/efl_ui_win.c
+++ b/src/lib/elementary/efl_ui_win.c
@@ -651,11 +651,14 @@ _shot_file_get(Efl_Ui_Win_Data *sd)
651 { 651 {
652 size_t size = sizeof(char) * (strlen(tmp) + 16); 652 size_t size = sizeof(char) * (strlen(tmp) + 16);
653 repname = malloc(size); 653 repname = malloc(size);
654 strncpy(repname, tmp, dotptr - tmp); 654 if (repname)
655 snprintf(repname + (dotptr - tmp), size - 655 {
656 (dotptr - tmp), "%03i", 656 strncpy(repname, tmp, dotptr - tmp);
657 sd->shot.shot_counter + 1); 657 snprintf(repname + (dotptr - tmp), size -
658 strcat(repname, dotptr); 658 (dotptr - tmp), "%03i",
659 sd->shot.shot_counter + 1);
660 strcat(repname, dotptr);
661 }
659 free(tmp); 662 free(tmp);
660 return repname; 663 return repname;
661 } 664 }
@@ -666,6 +669,7 @@ _shot_file_get(Efl_Ui_Win_Data *sd)
666 if (!sd->shot.repeat_count) return strdup("out.png"); 669 if (!sd->shot.repeat_count) return strdup("out.png");
667 670
668 repname = malloc(sizeof(char) * 24); 671 repname = malloc(sizeof(char) * 24);
672 if (!repname) return NULL;
669 snprintf(repname, sizeof(char) * 24, "out%03i.png", 673 snprintf(repname, sizeof(char) * 24, "out%03i.png",
670 sd->shot.shot_counter + 1); 674 sd->shot.shot_counter + 1);
671 675