Wed 28 Mar 2007 01:06:01 PM UTC, comment #4:
>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);
|