aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/elementary/efl_ui_win.c
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/elementary/efl_ui_win.c
parentecore_x: Avoid crash on NULL (diff)
downloadefl-c3d8a1d9f45fe990595bad9f3ed6ea81308754e6.tar.gz
efl_ui_win: add error hanling code for malloc fail
Diffstat (limited to 'src/lib/elementary/efl_ui_win.c')
-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)
{
size_t size = sizeof(char) * (strlen(tmp) + 16);
repname = malloc(size);
- strncpy(repname, tmp, dotptr - tmp);
- snprintf(repname + (dotptr - tmp), size -
- (dotptr - tmp), "%03i",
- sd->shot.shot_counter + 1);
- strcat(repname, dotptr);
+ if (repname)
+ {
+ strncpy(repname, tmp, dotptr - tmp);
+ snprintf(repname + (dotptr - tmp), size -
+ (dotptr - tmp), "%03i",
+ sd->shot.shot_counter + 1);
+ strcat(repname, dotptr);
+ }
free(tmp);
return repname;
}
@@ -666,6 +669,7 @@ _shot_file_get(Efl_Ui_Win_Data *sd)
if (!sd->shot.repeat_count) return strdup("out.png");
repname = malloc(sizeof(char) * 24);
+ if (!repname) return NULL;
snprintf(repname, sizeof(char) * 24, "out%03i.png",
sd->shot.shot_counter + 1);