From: Joshua Wise Date: Sun, 14 Dec 2008 01:32:46 +0000 (-0500) Subject: Ref only the head of a pbuf chain, instead of the whole thing, to avoid leaking pbufs. X-Git-Url: http://git.joshuawise.com/netwatch.git/commitdiff_plain/6b91f09cf683c29989ab259f4a433fb7d1427b36?hp=66cd7e8220e0f7dbb0e43f44f6aab60194548ad0 Ref only the head of a pbuf chain, instead of the whole thing, to avoid leaking pbufs. --- diff --git a/net/3c90x.c b/net/3c90x.c index 7b6a72e..d405352 100644 --- a/net/3c90x.c +++ b/net/3c90x.c @@ -432,12 +432,12 @@ static void _transmit(struct nic *_nic, struct pbuf *p) len = 0; n = 0; txpbufs[txprod] = p; + pbuf_ref(p); for (; p; p = p->next) { txdescs[txprod].segments[n].addr = v2p(p->payload); txdescs[txprod].segments[n].len = p->len | (p->next ? 0 : (1 << 31)); len += p->len; - pbuf_ref(p); n++; } txdescs[txprod].hdr = len; /* If we wanted completion notification, bit 15 */