add: memset(str_vals, 0, IDX_NO*sizeof(str));
context: static int m_dump(struct sip_msg* msg, char* str1, char* str2){	struct to_body to, *pto = NULL;	db_key_t db_keys[1] = { DB_KEY_RURI };	db_val_t db_vals[1];	db_key_t db_cols[] = {	DB_KEY_MID, DB_KEY_FROM, DB_KEY_TO, DB_KEY_BODY,							DB_KEY_CTYPE, DB_KEY_INC_TIME 					};	db_res_t* db_res = NULL;	int i, db_no_cols = IDX_NO, db_no_keys = 1, *msg_id, mid, n;	char hdr_buf[1024], body_buf[1024];	str str_vals[IDX_NO], hdr_str , body_str;	time_t rtime;	DBG("MSILO:m_dump: ------------ start ------------\n");	hdr_str.s=hdr_buf;	hdr_str.len=1024;	body_str.s=body_buf;	body_str.len=1024;		// check for TO header 	if(parse_headers(msg, HDR_TO, 0)==-1 || !msg->to || !msg->to->body.s)	{		LOG(L_ERR,"MSILO:m_dump: ERROR cannot find TO HEADER!\n");		goto error;	}	// check TO header	if(msg->to->parsed != NULL)	{		pto = (struct to_body*)msg->to->parsed;		DBG("MSILO:m_dump: 'To' header ALREADY PARSED: <%.*s>\n",			pto->uri.len, pto->uri.s );		}	else	{		memset( &to , 0, sizeof(to) );		parse_to(msg->to->body.s,			msg->to->body.s + msg->to->body.len + 1, &to);		if(to.uri.len <= 0) // || to.error != PARSE_OK)		{			DBG("MSILO:m_dump: 'To' header NOT parsed\n");			goto error;		}		pto = &to;	}	/**	 * check if has expires=0 (REGISTER)	 */	if(parse_headers(msg, HDR_EXPIRES, 0) >= 0)	{		//check 'expires' > 0		if(msg->expires && msg->expires->body.len > 0)		{			i = atoi(msg->expires->body.s);			if(i <= 0)			{ // user goes offline				DBG("MSILO:m_dump: user <%.*s> goes offline - expires=%d\n",						pto->uri.len, pto->uri.s, i);				goto error;			}			else				DBG("MSILO:m_dump: user <%.*s> online - expires=%d\n",						pto->uri.len, pto->uri.s, i);		}	}	else	{		DBG("MSILO:m_dump: 'exprires' threw error at parsing\n");		goto error;	}	db_vals[0].type = DB_STR;	db_vals[0].nul = 0;	db_vals[0].val.str_val.s = pto->uri.s;	db_vals[0].val.str_val.len = pto->uri.len;	memset(str_vals, 0, IDX_NO*sizeof(str));		if((db_query(db_con,db_keys,NULL,db_vals,db_cols,db_no_keys,db_no_cols,			NULL,&db_res)==0) && (RES_ROW_N(db_res) > 0))	{		DBG("MSILO:m_dump: dumping [%d] messages for <%.*s>!!!\n", 				RES_ROW_N(db_res), pto->uri.len, pto->uri.s);		for(i = 0; i < RES_ROW_N(db_res); i++) 		{			mid =  RES_ROWS(db_res)[i].values[DUMP_IDX_MID].val.int_val;			if(msg_list_check_msg(ml, mid))			{				DBG("MSILO:m_dump: message[%d] mid=%d already sent.\n", 					i, mid);				continue;			}						SET_STR_VAL(str_vals[STR_IDX_FROM], db_res, i, DUMP_IDX_FROM);			SET_STR_VAL(str_vals[STR_IDX_TO], db_res, i, DUMP_IDX_TO);			SET_STR_VAL(str_vals[STR_IDX_BODY], db_res, i, DUMP_IDX_BODY);			SET_STR_VAL(str_vals[STR_IDX_CTYPE], db_res, i, DUMP_IDX_CTYPE);						hdr_str.len = 1024;					if(m_build_headers(&hdr_str, str_vals[STR_IDX_CTYPE],					str_vals[STR_IDX_FROM]) < 0)			{				DBG("MSILO:m_dump: headers bulding failed!!!\n");				if (db_free_query(db_con, db_res) < 0)					DBG("MSILO:m_dump: Error while freeing result of"						" query\n");				msg_list_set_flag(ml, mid, MS_MSG_ERRO);				goto error;			}						if((msg_id = shm_malloc(sizeof(int))) == 0)			{				DBG("MSILO:m_dump: no more share memory!");				if (db_free_query(db_con, db_res) < 0)					DBG("MSILO:m_dump: Error while freeing result of"						" query\n");				msg_list_set_flag(ml, mid, MS_MSG_ERRO);				goto error;			}									*msg_id = mid;						DBG("MSILO:m_dump: msg [%d-%d] for: %.*s\n", i+1, *msg_id,					pto->uri.len, pto->uri.s);						/** sending using TM function: t_uac */			body_str.len = 1024;			rtime = 				(time_t)RES_ROWS(db_res)[i].values[DUMP_IDX_INC_TIME].val.int_val;			n = m_build_body(&body_str, rtime, str_vals[STR_IDX_BODY]);			if(n<0)				DBG("MSILO:m_dump: sending simple body\n");			else				DBG("MSILO:m_dump: sending composed body\n");						//tmb.t_uac(&msg_type, &pto->uri, &hdr_str,			//	&body_str, &str_vals[STR_IDX_FROM],			//	m_tm_callback, (void*)msg_id, 0			//);						tmb.t_request(&msg_type,  /* Type of the message */					&pto->uri,               /* Request-URI */					&str_vals[STR_IDX_TO],   /* To */					&str_vals[STR_IDX_FROM], /* From */					&hdr_str,         /* Optional headers including CRLF */					(n<0)?&str_vals[STR_IDX_BODY]:&body_str, /* Message body */					m_tm_callback,    /* Callback function */					(void*)msg_id     /* Callback parameter */				);		}	}	else		DBG("MSILO:m_dump: no stored message for <%.*s>!\n", pto->uri.len,					pto->uri.s);	/**	 * Free the result because we don't need it	 * anymore	 */	if (db_free_query(db_con, db_res) < 0)		DBG("MSILO:m_dump: Error while freeing result of query\n");	return 1;error:	return -1;}