broadband-modem,modem-helpers: improve +CGDCONT? error handling

This patch fixes the following crash, which happens when
MMBroadbandBearer tries to parse the NULL response of a failed +CGDCONT?
query. It also fixes a leak in parse_pdp_list where it fails to free the
GError object return by mm_3gpp_parse_cgdcont_read_response.

Thread 0 *CRASHED* ( SIGSEGV @ 0x00000000 )

0x7feb15564c11   [ModemManager]            - mm-modem-helpers.c:850      mm_3gpp_parse_cgdcont_read_response
0x7feb15518e51   [ModemManager]            - mm-broadband-bearer.c:927   parse_pdp_list
0x7feb1551ada2   [ModemManager]            - mm-base-modem-at.c:189      at_sequence_parse_response
0x7feb151d4b86   [libgio-2.0.so.0.3400.3]  - gsimpleasyncresult.c:775    g_simple_async_result_complete
0x7feb1556e223   [ModemManager]            - mm-port-serial-at.c:355     serial_command_ready
0x7feb151d4b86   [libgio-2.0.so.0.3400.3]  - gsimpleasyncresult.c:775    g_simple_async_result_complete
0x7feb1556a834   [ModemManager]            - mm-port-serial.c:141        command_context_complete_and_free
0x7feb1556bc26   [ModemManager]            - mm-port-serial.c:734        port_serial_got_response
0x7feb1556c51a   [ModemManager]            - mm-port-serial.c:758        port_serial_timed_out
0x7feb1508cc33   [libglib-2.0.so.0.3400.3] - gmain.c:4026                g_timeout_dispatch
0x7feb1508c087   [libglib-2.0.so.0.3400.3] - gmain.c:2715                g_main_context_dispatch
0x7feb1508c437   [libglib-2.0.so.0.3400.3] - gmain.c:3290                g_main_context_iterate
0x7feb1508c891   [libglib-2.0.so.0.3400.3] - gmain.c:3484                g_main_loop_run
0x7feb1550ad16   [ModemManager]            - main.c:154                  main
0x7feb14a9e9c6   [libc-2.15.so]            - libc-start.c:234            __libc_start_main
0x7feb1550a808   [ModemManager             + 0x00023808
This commit is contained in:
Ben Chan
2014-03-13 15:45:08 -07:00
committed by Aleksander Morgado
parent 6bdcd7cb22
commit 31a19c2299
2 changed files with 13 additions and 3 deletions

View File

@@ -924,10 +924,20 @@ parse_pdp_list (MMBaseModem *modem,
return FALSE;
}
if (error) {
mm_dbg ("Unexpected +CGDCONT? error: '%s'", error->message);
return FALSE;
}
pdp_list = mm_3gpp_parse_cgdcont_read_response (response, &inner_error);
if (!pdp_list) {
/* No predefined PDP contexts found */
mm_dbg ("No PDP contexts found");
if (inner_error) {
mm_dbg ("%s", inner_error->message);
g_error_free (inner_error);
} else {
/* No predefined PDP contexts found */
mm_dbg ("No PDP contexts found");
}
return FALSE;
}

View File

@@ -847,7 +847,7 @@ mm_3gpp_parse_cgdcont_read_response (const gchar *reply,
GMatchInfo *match_info;
GList *list;
if (!reply[0])
if (!reply || !reply[0])
/* No APNs configured, all done */
return NULL;