[sr-dev] git:master: dialog(k): reset the pointer value after free

Alex Balashov abalashov at evaristesys.com
Fri Oct 29 12:00:22 CEST 2010


Vielen dank!

On 10/29/2010 05:54 AM, Daniel-Constantin Mierla wrote:

> Module: sip-router
> Branch: master
> Commit: 4e196f47767dc8da8da560f57afc92add541b672
> URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=4e196f47767dc8da8da560f57afc92add541b672
>
> Author: Daniel-Constantin Mierla<miconda at gmail.com>
> Committer: Daniel-Constantin Mierla<miconda at gmail.com>
> Date:   Fri Oct 29 11:52:59 2010 +0200
>
> dialog(k): reset the pointer value after free
>
> - otherwise may result in double free, reported by Alex Balashov
>
> ---
>
>   modules_k/dialog/dlg_hash.c |   12 ++++++++++--
>   1 files changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/modules_k/dialog/dlg_hash.c b/modules_k/dialog/dlg_hash.c
> index 3ec22a4..0c14f05 100644
> --- a/modules_k/dialog/dlg_hash.c
> +++ b/modules_k/dialog/dlg_hash.c
> @@ -297,8 +297,16 @@ int dlg_set_leg_info(struct dlg_cell *dlg, str* tag, str *rr, str *contact,
>   	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) shm_free(dlg->tag[leg].s);
> -		if (dlg->cseq[leg].s) shm_free(dlg->cseq[leg].s);
> +		if (dlg->tag[leg].s)
> +		{
> +			shm_free(dlg->tag[leg].s);
> +			dlg->tag[leg].s = NULL;
> +		}
> +		if (dlg->cseq[leg].s)
> +		{
> +			shm_free(dlg->cseq[leg].s);
> +			dlg->cseq[leg].s = NULL;
> +		}
>   		return -1;
>   	}
>   	p = dlg->tag[leg].s;
>
>
> _______________________________________________
> sr-dev mailing list
> sr-dev at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev


-- 
Alex Balashov - Principal
Evariste Systems LLC
1170 Peachtree Street
12th Floor, Suite 1200
Atlanta, GA 30309
Tel: +1-678-954-0670
Fax: +1-404-961-1892
Web: http://www.evaristesys.com/



More information about the sr-dev mailing list