]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
core_unreal.c: Use ast instead of p->chan to get the DIALSTATUS variable
authorTinet-mucw <mucw@ti-net.com.cn>
Fri, 14 Nov 2025 02:01:28 +0000 (18:01 -0800)
committergithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Mon, 17 Nov 2025 14:09:11 +0000 (14:09 +0000)
After p->chan = NULL, ast still points to the valid channel object,
using ast safely accesses the channel's DIALSTATUS variable before it's fully destroyed

Resolves: #1590

main/core_unreal.c

index bcae2405b7d9c07186506d9aa6658fbb684a4c12..fd0f05b4e3076b65e648ad3261b7a5135ee7107f 100644 (file)
@@ -1042,7 +1042,7 @@ int ast_unreal_hangup(struct ast_unreal_pvt *p, struct ast_channel *ast)
                ast_clear_flag(p, AST_UNREAL_CARETAKER_THREAD);
                p->chan = NULL;
                if (p->owner) {
-                       const char *status = pbx_builtin_getvar_helper(p->chan, "DIALSTATUS");
+                       const char *status = pbx_builtin_getvar_helper(chan, "DIALSTATUS");
 
                        if (status) {
                                ast_channel_hangupcause_set(p->owner, cause);