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

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2015-08-27T08:57:52+02:00

dialog: handle malloc result for separated contact value

---

Modified: modules/dialog/dlg_hash.c

---

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

---

diff --git a/modules/dialog/dlg_hash.c b/modules/dialog/dlg_hash.c
index 6fb3e72..78093d8 100644
--- a/modules/dialog/dlg_hash.c
+++ b/modules/dialog/dlg_hash.c
@@ -519,7 +519,8 @@ int dlg_set_leg_info(struct dlg_cell *dlg, str* tag, str 
*rr, str *contact,
                dlg->contact[leg].s = (char*)shm_malloc( contact->len );
        }
 
-       if ( dlg->tag[leg].s==NULL || dlg->cseq[leg].s==NULL) {
+       if ( dlg->tag[leg].s==NULL || dlg->cseq[leg].s==NULL
+                       || dlg->contact[leg].s==NULL) {
                LM_ERR("no more shm mem\n");
                if (dlg->tag[leg].s)
                {
@@ -531,6 +532,12 @@ int dlg_set_leg_info(struct dlg_cell *dlg, str* tag, str 
*rr, str *contact,
                        shm_free(dlg->cseq[leg].s);
                        dlg->cseq[leg].s = NULL;
                }
+               if (dlg->contact[leg].s)
+               {
+                       shm_free(dlg->contact[leg].s);
+                       dlg->contact[leg].s = NULL;
+               }
+
                return -1;
        }
        p = dlg->tag[leg].s;


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to