Message ID | 20220704032308.2781-1-wangyouwan@uniontech.com |
---|---|
State | New |
Headers | show |
Series | obexd: fix crashed after cancel the on-going transfer | expand |
This is automated email and please do not reply to this email! Dear submitter, Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series: PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=656183 ---Test result--- Test Summary: CheckPatch PASS 1.55 seconds GitLint PASS 1.01 seconds Prep - Setup ELL PASS 27.01 seconds Build - Prep PASS 0.83 seconds Build - Configure PASS 8.58 seconds Build - Make PASS 834.50 seconds Make Check PASS 11.58 seconds Make Check w/Valgrind PASS 283.43 seconds Make Distcheck PASS 233.21 seconds Build w/ext ELL - Configure PASS 8.67 seconds Build w/ext ELL - Make PASS 80.27 seconds Incremental Build w/ patches PASS 0.00 seconds Scan Build WARNING 476.20 seconds Details ############################## Test: Scan Build - WARNING Desc: Run Scan Build with patches Output: ***************************************************************************** The bugs reported by the scan-build may or may not be caused by your patches. Please check the list and fix the bugs if they are caused by your patch. ***************************************************************************** gobex/gobex-transfer.c:426:7: warning: Use of memory after it is freed if (!g_slist_find(transfers, transfer)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. --- Regards, Linux Bluetooth
diff --git a/gobex/gobex-transfer.c b/gobex/gobex-transfer.c index c94d018b2..2f5c3e725 100644 --- a/gobex/gobex-transfer.c +++ b/gobex/gobex-transfer.c @@ -186,16 +186,19 @@ static void transfer_response(GObex *obex, GError *err, GObexPacket *rsp, gboolean rspcode, final; guint id; - g_obex_debug(G_OBEX_DEBUG_TRANSFER, "transfer %u", transfer->id); - - id = transfer->req_id; - transfer->req_id = 0; - if (err != NULL) { + if (!g_slist_find(transfers, transfer)) + return; + + transfer->req_id = 0; transfer_complete(transfer, err); return; } + g_obex_debug(G_OBEX_DEBUG_TRANSFER, "transfer %u", transfer->id); + + id = transfer->req_id; + transfer->req_id = 0; rspcode = g_obex_packet_get_operation(rsp, &final); if (rspcode != G_OBEX_RSP_SUCCESS && rspcode != G_OBEX_RSP_CONTINUE) { err = g_error_new(G_OBEX_ERROR, rspcode, "%s",