forked from enlightenment/efl
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
This commit is contained in:
parent
e3aca63428
commit
6539bc7788
|
@ -2842,7 +2842,8 @@ _format_dup(Evas_Object *eo_obj, const Evas_Object_Textblock_Format *fmt)
|
||||||
fmt2->gfx_filter = malloc(sizeof(*fmt2->gfx_filter));
|
fmt2->gfx_filter = malloc(sizeof(*fmt2->gfx_filter));
|
||||||
memcpy(fmt2->gfx_filter, fmt->gfx_filter, sizeof(*fmt->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->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;
|
return fmt2;
|
||||||
|
|
Loading…
Reference in New Issue