patch 9.1.1455: Haiku: dailog objects created with no reference

Problem:  Haiku: dailog objects created with no reference
Solution: delete the objects before returning (jinyaoguo)

In the functions gui_mch_dialog() and gui_mch_font_dialog(), Dialog
objects are created but never escape the function scope. The call to
dialog->Go() only returns a boolean value and does not retain any
reference to the Dialog object itself, which may lead to potential
memory leak.

Fix this by deleting the object after using it.

closes: #17501

Signed-off-by: jinyaoguo <guo846@purdue.edu>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/gui_haiku.cc b/src/gui_haiku.cc
index 748f97e..3865a4f 100644
--- a/src/gui_haiku.cc
+++ b/src/gui_haiku.cc
@@ -3820,7 +3820,9 @@
 #if defined(FEAT_GUI_DIALOG)
 	// gui.vimWindow->Unlock();
     VimSelectFontDialog *dialog = new VimSelectFontDialog(family, style, size);
-    return dialog->Go();
+    bool ret = dialog->Go();
+	delete dialog;
+	return ret;
 #else
     return NOFONT;
 #endif // FEAT_GUI_DIALOG
@@ -4917,7 +4919,9 @@
 {
     VimDialog *dialog = new VimDialog(type, (char*)title, (char*)message,
 	    (char*)buttons, dfltbutton, (char*)textfield, ex_cmd);
-    return dialog->Go();
+    bool ret = dialog->Go();
+    delete dialog;
+	return ret;
 }
 
 #endif // FEAT_GUI_DIALOG