This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/TMS320C6748: the udp_send function cannot free the RAM

Part Number: TMS320C6748

Tool/software: TI C/C++ Compiler

I'm using the lwip 1.3.2 example project to do some Ethernet work, it was modified months before, so now it's not possible to use the new 1.4.1 example to modify the old project again. While, the problem is that when I use the udp_sendto() function to send a udp packet, the program cannot free the RAM space which allocated by the pbuf_alloc() function.   

code:

int emac_send_data2(UINT8 arry[],int size,int port)
{
int temp;
static int ;

struct pbuf *q2 = NULL;

if(q2 == NULL)
{
q2 = pbuf_alloc(PBUF_TRANSPORT, size, PBUF_RAM);

}
if(!q2)
{
return -1;
}
memset(q2->payload, 0 , q2->len);
memcpy(q2->payload, arry, size);
temp = udp_sendto(upcb, q2, &addr, port);
pbuf_free(q2);
return temp;

}