diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2011-05-16 12:16:04 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2011-06-05 17:51:00 +0200 |
commit | 9323daec015ecad65c39b6020b62e864c027d858 (patch) | |
tree | 3a26a62be12c53effbdefabdc70ae27eea728e0e /plugins/mm-modem-option-utils.c | |
parent | f7dff81eecd6694c2596200fc2c3226de0396b7d (diff) |
core, plugins: if modem removed don't process response
We try to avoid a memory leak when info->error is reset, as well as a second
re-schedule of the info.
Diffstat (limited to 'plugins/mm-modem-option-utils.c')
-rw-r--r-- | plugins/mm-modem-option-utils.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/plugins/mm-modem-option-utils.c b/plugins/mm-modem-option-utils.c index 35dd1acd..61ca5d15 100644 --- a/plugins/mm-modem-option-utils.c +++ b/plugins/mm-modem-option-utils.c @@ -32,6 +32,11 @@ option_get_allowed_mode_done (MMAtSerialPort *port, MMCallbackInfo *info = (MMCallbackInfo *) user_data; gboolean parsed = FALSE; + /* If the modem has already been removed, return without + * scheduling callback */ + if (mm_callback_info_check_modem_removed (info)) + return; + if (error) info->error = g_error_copy (error); else if (!g_str_has_prefix (response->str, "_OPSYS: ")) { @@ -95,6 +100,11 @@ option_set_allowed_mode_done (MMAtSerialPort *port, { MMCallbackInfo *info = (MMCallbackInfo *) user_data; + /* If the modem has already been removed, return without + * scheduling callback */ + if (mm_callback_info_check_modem_removed (info)) + return; + if (error) info->error = g_error_copy (error); @@ -357,8 +367,14 @@ unsolicited_msg_done (MMAtSerialPort *port, { MMCallbackInfo *info = user_data; - if (info) + if (info) { + /* If the modem has already been removed, return without + * scheduling callback */ + if (mm_callback_info_check_modem_removed (info)) + return; + mm_callback_info_chain_complete_one (info); + } } static void @@ -394,6 +410,11 @@ get_act_octi_request_done (MMAtSerialPort *port, MMModemGsmAccessTech octi = MM_MODEM_GSM_ACCESS_TECH_UNKNOWN; MMModemGsmAccessTech owcti; + /* If the modem has already been removed, return without + * scheduling callback */ + if (mm_callback_info_check_modem_removed (info)) + return; + if (!error) { if (parse_octi_response (response, &octi)) { /* If no 3G tech yet or current tech isn't 3G, then 2G tech is the best */ @@ -416,6 +437,11 @@ get_act_owcti_request_done (MMAtSerialPort *port, MMModemGsmAccessTech owcti = MM_MODEM_GSM_ACCESS_TECH_UNKNOWN; const char *p; + /* If the modem has already been removed, return without + * scheduling callback */ + if (mm_callback_info_check_modem_removed (info)) + return; + if (!error) { p = mm_strip_tag (response->str, "_OWCTI:"); if (owcti_to_mm (*p, &owcti)) { |