--- ../libqmi-1.16.0/src/libqmi-glib/qmi-device.c 2016-11-04 10:51:52.870085915 +0100 +++ src/libqmi-glib/qmi-device.c 2016-11-03 15:18:04.077950054 +0100 @@ -244,14 +244,16 @@ GError *error = NULL; tr = device_release_transaction (ctx->self, ctx->key); - tr->timeout_source = NULL; + if (tr) { + tr->timeout_source = NULL; - /* Complete transaction with a timeout error */ - error = g_error_new (QMI_CORE_ERROR, - QMI_CORE_ERROR_TIMEOUT, - "Transaction timed out"); - transaction_complete_and_free (tr, NULL, error); - g_error_free (error); + /* Complete transaction with a timeout error */ + error = g_error_new (QMI_CORE_ERROR, + QMI_CORE_ERROR_TIMEOUT, + "Transaction timed out"); + transaction_complete_and_free (tr, NULL, error); + g_error_free (error); + } return FALSE; } @@ -264,14 +266,16 @@ GError *error = NULL; tr = device_release_transaction (ctx->self, ctx->key); - tr->cancellable_id = 0; + if (tr) { + tr->cancellable_id = 0; - /* Complete transaction with an abort error */ - error = g_error_new (QMI_PROTOCOL_ERROR, - QMI_PROTOCOL_ERROR_ABORTED, - "Transaction aborted"); - transaction_complete_and_free (tr, NULL, error); - g_error_free (error); + /* Complete transaction with an abort error */ + error = g_error_new (QMI_PROTOCOL_ERROR, + QMI_PROTOCOL_ERROR_ABORTED, + "Transaction aborted"); + transaction_complete_and_free (tr, NULL, error); + g_error_free (error); + } } static gboolean