aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorJean-Philippe André <jpeg@videolan.org>2019-01-09 12:46:38 -0500
committerMike Blumenkrantz <zmike@samsung.com>2019-01-09 13:08:39 -0500
commit6539bc7788f71d1265c9242f51400b4f713752ce (patch)
tree992b683948a0febe93688d0767d8f13943b6f1ba /src/lib
parentefl_ui_text: remove duplicated empty string initialization (diff)
downloadefl-6539bc7788f71d1265c9242f51400b4f713752ce.tar.gz
textblock: Fix crash with filters
Summary: A crash could happen on a bad call to free() context_dup() returns a newly malloc'ed context if passed NULL (this seems dubious to me, why not calloc?). @fix Test Plan: Add an empty efl.ui.text object Set markup text as "<gfx_filter='code'>Hello</>" Reviewers: cedric, segfaultxavi, Jaehyun, herdsman, zmike Reviewed By: zmike Subscribers: zmike, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D7368
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/evas/canvas/evas_object_textblock.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c
index 339d153f83..b33cb6f5eb 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -2842,7 +2842,8 @@ _format_dup(Evas_Object *eo_obj, const Evas_Object_Textblock_Format *fmt)
fmt2->gfx_filter = malloc(sizeof(*fmt2->gfx_filter));
memcpy(fmt2->gfx_filter, fmt->gfx_filter, sizeof(*fmt->gfx_filter));
fmt2->gfx_filter->name = eina_stringshare_ref(fmt->gfx_filter->name);
- fmt2->gfx_filter->dc = ENFN->context_dup(ENC, fmt->gfx_filter->dc);
+ if (fmt->gfx_filter->dc)
+ fmt2->gfx_filter->dc = ENFN->context_dup(ENC, fmt->gfx_filter->dc);
}
return fmt2;