From b2bca4e5dac28319d4e3ee5e82b08e7c8bbf31d8 Mon Sep 17 00:00:00 2001 From: Edmunt Pienkowsky Date: Fri, 21 Jun 2024 13:34:42 +0200 Subject: [PATCH] Fix response handler Free task data at the very end of task execution. --- src/at_response.c | 4 ++-- src/chan_quectel.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/at_response.c b/src/at_response.c index ee2a28e8..f245c5de 100644 --- a/src/at_response.c +++ b/src/at_response.c @@ -3040,9 +3040,9 @@ struct at_response_taskproc_data* at_response_taskproc_data_alloc(struct pvt* co static void response_taskproc(struct pvt_taskproc_data* ptd) { - RAII_VAR(struct at_response_taskproc_data* const, rtd, (struct at_response_taskproc_data*)ptd, ast_free); + struct at_response_taskproc_data* const rtd = (struct at_response_taskproc_data*)ptd; + const at_res_t at_res = at_str2res(&rtd->response); - const at_res_t at_res = at_str2res(&rtd->response); if (at_res != RES_UNKNOWN) { ast_str_trim_blanks(&rtd->response); } diff --git a/src/chan_quectel.c b/src/chan_quectel.c index 7d48ff76..1b7b6b17 100644 --- a/src/chan_quectel.c +++ b/src/chan_quectel.c @@ -684,6 +684,7 @@ int pvt_taskproc_lock_and_execute(struct pvt_taskproc_data* ptd, void (*task_exe task_exe(ptd); ast_debug(6, "[%s][%s] Task executed\n", PVT_ID(ptd->pvt), S_OR(task_name, "UNKNOWN")); AO2_UNLOCK_AND_UNREF(ptd->pvt); + ast_free(ptd); return 0; }