handling mdev in INPUT structure

This commit is contained in:
Vincent Wei
2020-03-12 11:15:59 +08:00
parent 6927a22507
commit 7651fbda35

View File

@@ -291,7 +291,8 @@ int mg_InitIAL (void)
return ERR_NO_MATCH;
}
//strcpy (__mg_cur_input->mdev, mdev);
/* BUGFIXING (VM 2020-03-12): merged from 5.0.0 */
__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);
@@ -306,8 +307,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 ();
}
}