rem: error: if (!cpl_intr && script.s) shm_free(script.s); if (cpl_intr) free_cpl_interpreter( cpl_intr );
add: error3: free_cpl_interpreter( cpl_intr ); return -1; error2: shm_free(script.s); error1: shm_free(user.s); error0:
context: static int cpl_invoke_script(struct sip_msg* msg, char* str1, char* str2){	struct cpl_interpreter  *cpl_intr;	str  user;	str  loc;	str  script;	script.s = 0;	cpl_intr = 0;	/* get the user_name */	if ( ((unsigned int)str1)&CPL_RUN_INCOMING ) {		/* if it's incoming -> get the destination user name */		if (get_dest_user( msg, &user)==-1)			goto error;	} else {		/* if it's outgoing -> get the origin user name */		if (get_orig_user( msg, &user)==-1)			goto error;	}	/* get the script for this user */	if (get_user_script( db_hdl, &user, &script, "cpl_bin")==-1)		goto error;	/* has the user a non-empty script? if not, return normaly, allowing ser to	 * continue its script */	if ( !script.s || !script.len )		return 1;	/* build a new script interpreter */	if ( (cpl_intr=new_cpl_interpreter(msg,&script))==0 )		goto error;	/* set the flags */	cpl_intr->flags = ((unsigned int)str1);	/* attache the user */	cpl_intr->user = user;	/* for OUTGOING we need also the destination user for init. with him	 * the location set */	if ( ((unsigned int)str1)&CPL_RUN_OUTGOING ) {		if (get_dest_user( msg, &loc)==-1)			goto error;		if (add_location( &(cpl_intr->loc_set), &loc,10/*prio*/,1/*dup*/)==-1)			goto error;	}	/* since the script interpretation can take some time, it will be better to	 * send a 100 back to prevent the UAC to retransmit */	if ( cpl_tmb.t_reply( msg, (int)100, "Running cpl script" )!=1 ) {		LOG(L_ERR,"ERROR:cpl_invoke_script: unable to send 100 reply!\n");		goto error;	}	/* run the script */	switch (cpl_run_script( cpl_intr )) {		case SCRIPT_DEFAULT:			free_cpl_interpreter( cpl_intr );			return 1; /* execution of ser's script will continue */		case SCRIPT_END:			free_cpl_interpreter( cpl_intr );		case SCRIPT_TO_BE_CONTINUED:			return 0; /* break the SER script */		case SCRIPT_RUN_ERROR:		case SCRIPT_FORMAT_ERROR:			goto error;	}	return 1;error:	if (!cpl_intr && script.s)		shm_free(script.s);	if (cpl_intr)		free_cpl_interpreter( cpl_intr );	return -1;}