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-simtech-gsm.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-simtech-gsm.c')
-rw-r--r-- | plugins/mm-modem-simtech-gsm.c | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/plugins/mm-modem-simtech-gsm.c b/plugins/mm-modem-simtech-gsm.c index 4a626947..5d420335 100644 --- a/plugins/mm-modem-simtech-gsm.c +++ b/plugins/mm-modem-simtech-gsm.c @@ -67,9 +67,15 @@ get_mode_pref_done (MMAtSerialPort *port, guint32 acqord; MMModemGsmAllowedMode allowed = MM_MODEM_GSM_ALLOWED_MODE_ANY; - info->error = mm_modem_check_removed (info->modem, error); - if (info->error) + /* 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); goto done; + } p = mm_strip_tag (response->str, "+CNMP:"); if (!p) { @@ -125,9 +131,15 @@ get_acq_order_done (MMAtSerialPort *port, const char *p; gint acqord = -1; - info->error = mm_modem_check_removed (info->modem, error); - if (info->error) + /* 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); goto done; + } p = mm_strip_tag (response->str, "+CNAOP:"); if (!p) { @@ -182,6 +194,11 @@ set_acq_order_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); @@ -198,8 +215,13 @@ set_mode_pref_done (MMAtSerialPort *port, guint32 naop; char *command; - info->error = mm_modem_check_removed (info->modem, error); - if (info->error) { + /* 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); mm_callback_info_schedule (info); return; } @@ -286,8 +308,13 @@ get_act_tech_done (MMAtSerialPort *port, MMModemGsmAccessTech act = MM_MODEM_GSM_ACCESS_TECH_UNKNOWN; const char *p; - info->error = mm_modem_check_removed (info->modem, error); - if (info->error) { + /* 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); mm_callback_info_schedule (info); return; } |