Fix unverified realloc (#1486)

* temporary fix
This commit is contained in:
Herman Semenoff
2026-07-12 13:51:08 +02:00
committed by GitHub
parent 6f8548a98d
commit 9952017a03
+8 -1
View File
@@ -2014,7 +2014,14 @@ void Fl::watch_widget_pointer(Fl_Widget *&w)
}
if (num_widget_watch==max_widget_watch) {
max_widget_watch += 8;
widget_watch = (Fl_Widget***)realloc(widget_watch, sizeof(Fl_Widget**)*max_widget_watch);
Fl_Widget*** new_widget_watch = (Fl_Widget***)realloc(widget_watch, sizeof(Fl_Widget**)*max_widget_watch);
if (new_widget_watch) {
widget_watch = new_widget_watch;
} else {
// realloc failed, original widget_watch is still valid.
// Return to avoid using a potentially invalid pointer.
return;
}
}
widget_watch[num_widget_watch++] = wp;
#ifdef DEBUG_WATCH