lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [bug #19432] netbuf_ref doesn't check pbuf_alloc result


From: Frédéric Bernon
Subject: [lwip-devel] [bug #19432] netbuf_ref doesn't check pbuf_alloc result
Date: Wed, 28 Mar 2007 13:06:02 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3

Follow-up Comment #4, bug #19432 (project lwip):

>Should the new line:
>buf->ptr = NULL;
>be
>buf->p = NULL; 

I don't think, because next line (the pbuf_alloc) will initialize (or set to
NULL) the buf->p. Because in most of netbuf_ functions, like netbuf_alloc,
netbuf_free, or even at the end of netbuf_ref, a "just initialized" netbuf
have to get buf->p = buf->ptr. So, I think the patch is correct to this point
of view. 

The only caller is lwip_send, but the crash is directly inside netbuf_ref,
because event if p==NULL efter pbuf_alloc, we call buf->p->payload.

I actually work on lwip_send (for the other bug report), but call should be
something like :


    /* make the buffer point to the data that should be sent */
    if ((err = netbuf_ref(buf, data, size))==ERR_OK) {
      /* send the data */
      err = netconn_send(sock->conn, buf);
    }

    /* deallocated the buffer */
    netbuf_delete(buf);




    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?19432>

_______________________________________________
  Message posté via/par Savannah
  http://savannah.nongnu.org/





reply via email to

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