lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] Memory leak in udp_send() (lwip v1.1.0)


From: Olaf Peters
Subject: [lwip-users] Memory leak in udp_send() (lwip v1.1.0)
Date: Tue, 31 May 2005 18:09:56 +0200

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.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]