Fixes a use-after-free

This commit is contained in:
Mathias Buhr 2017-04-22 01:14:49 +02:00
parent 2accf3694a
commit 92365eca0f
1 changed files with 3 additions and 2 deletions

View File

@ -282,11 +282,11 @@ Fl_Widget::label(const char *a) {
void
Fl_Widget::copy_label(const char *a) {
if (flags() & COPIED_LABEL) free((void *)(label_.value));
if ( ( !a || !label_.value ) || strcmp( a, label_.value ) )
redraw_label();
if (flags() & COPIED_LABEL) free((void *)(label_.value));
if (a) {
set_flag(COPIED_LABEL);
label_.value=strdup(a);
@ -294,6 +294,7 @@ Fl_Widget::copy_label(const char *a) {
clear_flag(COPIED_LABEL);
label_.value=(char *)0;
}
}
/** Calls the widget callback.