From 7651fbda35083d6640bb5645445f9190b1ce798e Mon Sep 17 00:00:00 2001 From: Vincent Wei Date: Thu, 12 Mar 2020 11:15:59 +0800 Subject: [PATCH] handling mdev in INPUT structure --- src/ial/ial.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/ial/ial.c b/src/ial/ial.c index dc636996..cb31ab3e 100644 --- a/src/ial/ial.c +++ b/src/ial/ial.c @@ -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 (); } }