rem: free_uri_format (format);
add: free_uri_format (&format);
context: decode_uri (str uri, char separator, str * result){	char *pos;	struct uri_format format;	int foo;	(*result).s = NULL;	(*result).len = 0;	if ((uri.len <= 0) || (uri.s == NULL))		return -1;	foo = decode2format (uri, separator, &format);	if (foo < 0)		return foo - 20;	/* a complete uri would be sip:username:password@ip:port;transport=protocol goes to	 * sip:enc_pref#username#password#ip#port#protocol@public_ip	 */	(*result).len = format.first + (uri.len - format.second);	/* not NULL terminated */	if (format.username.len > 0)		(*result).len += format.username.len + 1;	//: or @	if (format.password.len > 0)		(*result).len += format.password.len + 1;	//@	if (format.ip.len > 0)		(*result).len += format.ip.len;	else	{		foo = -3;		goto error3;	}			/* should I quit or ignore ? */	if (format.port.len > 0)		(*result).len += 1 + format.port.len;	//:	if (format.protocol.len > 0)		(*result).len += 1 + 10 + format.protocol.len;	//;transport=	fprintf (stdout, "Result size is %d.Original Uri size is %d\n",		 (*result).len, uri.len);	/* adding one comes from * */	(*result).s = pkg_malloc ((*result).len);	pos = (*result).s;	fprintf (stdout, "Adding [%d] ->%.*s\n", format.first, format.first,		 uri.s);	fflush (stdout);	memcpy (pos, uri.s, format.first);	/* till sip: */	pos = pos + format.first;	//memcpy(pos,"sip:",4);pos = pos + 4;	if (format.username.len > 0)	{		memcpy (pos, format.username.s, format.username.len);		pos = pos + format.username.len;		if (format.password.len > 0)			memcpy (pos, ":", 1);		else			memcpy (pos, "@", 1);		pos = pos + 1;	}	if (format.password.len > 0)	{		if (format.username.len <= 0)		{			foo = -4;			goto error3;		}		/* error: this is going to look like a username */		memcpy (pos, format.password.s, format.password.len);		pos = pos + format.password.len;		memcpy (pos, "@", 1);		pos = pos + 1;	}	if (format.ip.len > 0)	{		memcpy (pos, format.ip.s, format.ip.len);		pos = pos + format.ip.len;	}	if (format.port.len > 0)	{		memcpy (pos, ":", 1);		pos = pos + 1;		memcpy (pos, format.port.s, format.port.len);		pos = pos + format.port.len;	}	if (format.protocol.len > 0)	{		memcpy (pos, ";transport=", 11);		pos = pos + 11;		memcpy (pos, format.protocol.s, format.protocol.len);		pos = pos + format.protocol.len;	}	fprintf (stdout, "Adding2 [%d] ->%.*s\n", uri.len - format.second,		 uri.len - format.second, uri.s + format.second);	fflush (stdout);	memcpy (pos, uri.s + format.second, uri.len - format.second);	/* till end: */	free_uri_format (format);	fprintf (stdout, "New decoded uri is->[%.*s]\n", (*result).len,		 (*result).s);	return 0;error3:	free_uri_format (format);	return foo;}