Hi,

I discovered a potential memory leak in the routine udp_send() in lwip.c,
line 410 and on:

  /* not enough space to add an UDP header to first pbuf in given p chain?
*/
  if (pbuf_header(p, UDP_HLEN)) {
    /* allocate header in a seperate new pbuf */
    q = pbuf_alloc(PBUF_IP, UDP_HLEN, PBUF_RAM);

  ...

  /* find the outgoing network interface for this packet */
  netif = ip_route(&(pcb->remote_ip));
  /* no outgoing network interface could be found? */
  if (netif == NULL) {
    LWIP_DEBUGF(UDP_DEBUG | 1, ("udp_send: No route to 0x%lx\n",
pcb->remote_ip.addr));
    UDP_STATS_INC(udp.rterr);
    return ERR_RTE;
  }

In above code, if ip_route() didn't find a route, it returns with an error
code but doesn't free the allocated memory for the UDP header (assigned to q
above).
Is this a memory leak or do I miss something?

Olaf.




_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to