diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2023-05-08 16:26:07 +0200 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2023-05-08 16:26:07 +0200 |
| commit | ac7b55d8bbd249e400c7b3282e50cd88ae8f71b6 (patch) | |
| tree | d6513ca7134694870aeebc9c95ff1040ea5c3f28 /test | |
| parent | 712fc72fef6e92851b69f9d6e448b3ea7cd10215 (diff) | |
Fix some but not all memory leaks in test/utf8 demo
Note: Fl_Input::value() copies the string to an internal buffer,
fl_strdup() before value() is not necessary.
Diffstat (limited to 'test')
| -rw-r--r-- | test/utf8.cxx | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/test/utf8.cxx b/test/utf8.cxx index 5510a84ce..40890c641 100644 --- a/test/utf8.cxx +++ b/test/utf8.cxx @@ -622,10 +622,10 @@ int main(int argc, char** argv) snprintf(bu, sizeof(bu), "0x%06X", y * 16); Fl_Input *b = new Fl_Input(200,(y-off)*25,80,25); b->textfont(FL_COURIER); - b->value(fl_strdup(bu)); + b->value(bu); b = new Fl_Input(280,(y-off)*25,380,25); b->textfont(extra_font); - b->value(fl_strdup(buf)); + b->value(buf); } scroll.end(); main_win->resizable(scroll); @@ -644,6 +644,11 @@ int main(int argc, char** argv) utf8u[l] = '\0'; i3.value(utf8u); + // free strings that are no longer used + free(utf8u); + free(utf8l); + free(utf8); + const char *ltr_txt = "\\->e\xCC\x82=\xC3\xAA"; Fl_Input i4(5, 90, 190, 25); i4.value(ltr_txt); |
