Module: kamailio
Branch: master
Commit: c2e62cd2dfb0c9969f7e410020fa3a39f343d608
URL: 
https://github.com/kamailio/kamailio/commit/c2e62cd2dfb0c9969f7e410020fa3a39f343d608

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2025-11-23T11:21:04+01:00

auth_db: init variable and set the result header later

---

Modified: src/modules/auth_db/authorize.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/c2e62cd2dfb0c9969f7e410020fa3a39f343d608.diff
Patch: 
https://github.com/kamailio/kamailio/commit/c2e62cd2dfb0c9969f7e410020fa3a39f343d608.patch

---

diff --git a/src/modules/auth_db/authorize.c b/src/modules/auth_db/authorize.c
index a1629f0624f..f1c4b6d6243 100644
--- a/src/modules/auth_db/authorize.c
+++ b/src/modules/auth_db/authorize.c
@@ -237,7 +237,7 @@ static int digest_authenticate_hdr(sip_msg_t *msg, str 
*realm, str *table,
        char ha1[256];
        auth_cfg_result_t ret;
        auth_result_t rauth;
-       struct hdr_field *h;
+       struct hdr_field *h = NULL;
        auth_body_t *cred;
        db1_res_t *result = NULL;
 
@@ -283,8 +283,6 @@ static int digest_authenticate_hdr(sip_msg_t *msg, str 
*realm, str *table,
        }
 
        cred = (auth_body_t *)h->parsed;
-       if(ahdr != NULL)
-               *ahdr = h;
 
        rauth = get_ha1(&cred->digest.username, realm, table, ha1, &result);
        if(rauth < 0) {
@@ -326,6 +324,9 @@ static int digest_authenticate_hdr(sip_msg_t *msg, str 
*realm, str *table,
        }
 
 end:
+       if(ahdr != NULL) {
+               *ahdr = h;
+       }
        if(result)
                auth_dbf.free_result(auth_db_handle, result);
        return ret;

_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to