copy mdev and free mdev

This commit is contained in:
Vincent Wei
2020-03-10 18:49:33 +08:00
parent e15ed80dba
commit c6742049b7
+7 -2
View File
@@ -290,6 +290,7 @@ int mg_InitIAL (void)
}
//strcpy (__mg_cur_input->mdev, mdev);
__mg_cur_input->mdev = strdup (mdev);
if (!IAL_InitInput (__mg_cur_input, mdev, mtype)) {
_ERR_PRINTF ("IAL: Failed to initialize the IAL engine: %s.\n", __mg_cur_input->id);
@@ -304,8 +305,12 @@ int mg_InitIAL (void)
void mg_TerminateIAL (void)
{
if (__mg_cur_input && __mg_cur_input->term_input) {
IAL_TermInput ();
if (__mg_cur_input) {
if (__mg_cur_input->mdev)
free (__mg_cur_input->mdev);
if (__mg_cur_input->term_input)
IAL_TermInput ();
}
}