rem: if (!new_msg->via1) goto hf_error;
add: if (!new_msg->via1) { DBG("DEBUG: sip_msg_cloner:  new_msg->via1 allocation failed\n"); goto hf_error; }
context: struct sip_msg* sip_msg_cloner( struct sip_msg *org_msg ){    struct sip_msg   *new_msg=0;    struct hdr_field  *header, *last_hdr, *new_hdr;    /* clones the sip_msg structure */    new_msg = (struct sip_msg*)sh_malloc( sizeof( struct sip_msg) );    if (!new_msg) return NULL;    memcpy( new_msg , org_msg , sizeof( struct sip_msg) );    /* the original message - orig ( char*  type) */    new_msg->orig = (char*)sh_malloc( new_msg->len+1 );    if (!new_msg->orig) {	goto error;    }    memcpy( new_msg->orig , org_msg->orig, new_msg->len );    new_msg->orig[ new_msg->len ] = 0;    /* the scratch pad - buf ( char* type) */    new_msg->buf = (char*)sh_malloc( new_msg->len+1 );    if (!new_msg->buf) {	goto error;    }    memcpy( new_msg->buf , org_msg->buf, new_msg->len );    new_msg->buf[ new_msg->len ] = 0;    /* where the parse stopped - unparsed (char* type)*/    new_msg->unparsed = translate_pointer( new_msg->buf , org_msg->buf , org_msg->unparsed );    /* end of header - eoh (char* type)*/    new_msg->eoh = translate_pointer( new_msg->buf , org_msg->buf , org_msg->eoh );    /* first_line (struct msg_start type) */    if ( org_msg->first_line.type==SIP_REQUEST )    {	/* method (str type) */	new_msg->first_line.u.request.method.s = translate_pointer( new_msg->buf , org_msg->buf , org_msg->first_line.u.request.method.s );	/* uri (str type) */	new_msg->first_line.u.request.uri.s = translate_pointer( new_msg->buf , org_msg->buf , org_msg->first_line.u.request.uri.s );	/* version (str type) */	new_msg->first_line.u.request.version.s = translate_pointer( new_msg->buf , org_msg->buf , org_msg->first_line.u.request.version.s );    }    else if ( org_msg->first_line.type==SIP_REPLY )    {	/* version (str type) */	new_msg->first_line.u.reply.version.s = translate_pointer( new_msg->buf , org_msg->buf , org_msg->first_line.u.reply.version.s );	/* status (str type) */	new_msg->first_line.u.reply.status.s =  translate_pointer( new_msg->buf , org_msg->buf , org_msg->first_line.u.reply.status.s );	/* reason (str type) */	new_msg->first_line.u.reply.reason.s =  translate_pointer( new_msg->buf , org_msg->buf , org_msg->first_line.u.reply.reason.s );    }    /* new_uri  ( str type )*/	if (org_msg->new_uri.s){ 		if (!(new_msg->new_uri.s = (char*)sh_malloc( org_msg->new_uri.len )))			goto error;		memcpy( new_msg->new_uri.s , org_msg->new_uri.s ,				org_msg->new_uri.len );	}    /* add_rm ( struct lump* )  -> have to be changed!!!!!!! */    new_msg->add_rm  = 0;    /* repl_add_rm ( struct lump* ) -> have to be changed!!!!!!!  */    new_msg->repl_add_rm  = 0;    /* all the headers */    new_msg->via1=0;    new_msg->via2=0;    for( header = org_msg->headers , last_hdr=0  ;  header ; header=header->next)    {	new_hdr = header_cloner( new_msg , org_msg , header );	if (!new_hdr) 		goto error;	switch ( header->type )	{	    case HDR_VIA :		if ( !new_msg->via1 )		{		    new_msg->h_via1 = new_hdr;		    new_msg->via1 = via_body_cloner( new_msg->buf , org_msg->buf , (struct via_body*)header->parsed );		    if (!new_msg->via1) goto hf_error;		    		    new_hdr->parsed  = (void*)new_msg->via1;		     if ( new_msg->via1->next )		        new_msg->via2 = new_msg->via1->next;		}		else if ( !new_msg->via2 && new_msg->via1 )		{		     new_msg->h_via2 = new_hdr;		     if ( new_msg->via1->next )		        new_hdr->parsed = (void*)new_msg->via1->next;		     else{		        new_msg->via2 = via_body_cloner( new_msg->buf , org_msg->buf , (struct via_body*)header->parsed );			if (!new_msg->via2) goto hf_error;		        new_hdr->parsed  = (void*)new_msg->via2;		     }		}		else if ( new_msg->via2 && new_msg->via1 )		{		    new_hdr->parsed  = new_msg->via1 = via_body_cloner( new_msg->buf , org_msg->buf , (struct via_body*)header->parsed );		    if (!new_hdr->parsed) goto hf_error;		}		break;	    case HDR_FROM :		new_msg->from = new_hdr;		break;	    case HDR_TO :		new_msg->to = new_hdr;		break;	    case HDR_CSEQ :		if (header->parsed)		{		  new_hdr->parsed = (void*)sh_malloc( sizeof(struct cseq_body) );		  if (!new_hdr->parsed) goto hf_error;		  memcpy( new_hdr->parsed , header->parsed , sizeof(struct cseq_body) );		  ((struct cseq_body*)new_hdr->parsed)->number.s = translate_pointer( new_msg->buf , org_msg->buf , ((struct cseq_body*)header->parsed)->number.s );		  ((struct cseq_body*)new_hdr->parsed)->method.s = translate_pointer( new_msg->buf , org_msg->buf , ((struct cseq_body*)header->parsed)->method.s );		}		new_msg->cseq = new_hdr;		break;	    case HDR_CALLID :		new_msg->callid = new_hdr;		break;	    case HDR_CONTACT :		new_msg->contact = new_hdr;		break;	    default :		break;	}	if ( last_hdr )	{	    last_hdr->next = new_hdr;	    last_hdr=last_hdr->next;	 }	 else	 {	    last_hdr=new_hdr;	    new_msg->headers =new_hdr;	}    	last_hdr->next = 0;    	new_msg->last_header = last_hdr;    }    return new_msg;hf_error:	sh_free( new_hdr );error:	sip_msg_free( new_msg );	sh_free( new_msg );	return 0;}