[SR-Users] dialog: cseq

Daniel-Constantin Mierla miconda at gmail.com
Fri Jun 21 19:32:13 CEST 2013


Hello,

some comments inline.

On 6/14/13 2:03 PM, Halina Nowak wrote:
> Proposal for cseq:
>
> cseq numbering:
>
> --- a/modules/dialog/dlg_handlers.c    Wed Apr 03 13:33:38 2013 +0200
> +++ b/modules/dialog/dlg_handlers.c    Fri Jun 14 13:39:47 2013 +0200
> @@ -220,7 +220,7 @@
>          cseq = (get_cseq(msg))->number;
>      } else {
>          /* use the same as in request */
> -        cseq = dlg->cseq[DLG_CALLER_LEG];
> +        cseq = dlg->cseq[DLG_CALLEE_LEG];

at quick check, the comment says the cseq is taken from the request 
because it is processing the reply in this part of the code.

You change that to take the value of the stored cseq for callee, which 
is different than the current processed message.

What was the problem you discovered? Can you give an example to 
understand this change?

>      }
>
>
> avoid memory leak:
>
> --- a/modules/dialog/dlg_hash.c    Fri Jun 14 13:40:12 2013 +0200
> +++ b/modules/dialog/dlg_hash.c    Fri Jun 14 13:45:21 2013 +0200
> @@ -485,7 +485,14 @@
>      char *p;
>
>      dlg->tag[leg].s = (char*)shm_malloc( tag->len + rr->len + 
> contact->len );
> -    dlg->cseq[leg].s = (char*)shm_malloc( cseq->len );
> +    if(dlg->cseq[leg].s){
> +      if (dlg->cseq[leg].len < cseq->len) {
> +        shm_free(dlg->cseq[leg].s);
> +        dlg->cseq[leg].s = (char*)shm_malloc(cseq->len);
> +      }
> +    }else{
> +      dlg->cseq[leg].s = (char*)shm_malloc( cseq->len );
> +    }
>      if ( dlg->tag[leg].s==NULL || dlg->cseq[leg].s==NULL) {
>          LM_ERR("no more shm mem\n");
>          if (dlg->tag[leg].s)
I see tag is also allocated each time, isn't it exposed to same issue? 
You changed only cseq to reuse existing buffer or free the old one and 
allocate a bigger one when needed.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20130621/ca2d3b5a/attachment.html>


More information about the sr-users mailing list