Skip to contentSkip to conversation

slirp: fix use-after-free

PATCH New Mark McLoughlin 1 participant 1 message Nov 20, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 slirp: fix use-after-free

460fec67ee introduced a use-after free in slirp.

---

Untested fix, but it's obvious.

Also, this is needed on stable-0.11.

 slirp/mbuf.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
slirp/mbuf.c +1 -1
index 7652fea..87508ba 100644
@@ -95,8 +95,8 @@ m_free(struct mbuf *m)
 	 * Either free() it or put it on the free list
 	 */
 	if (m->m_flags & M_DOFREE) {
-		free(m);
 		m->slirp->mbuf_alloced--;
+		free(m);
 	} else if ((m->m_flags & M_FREELIST) == 0) {
 		insque(m,&m->slirp->m_freelist);
 		m->m_flags = M_FREELIST; /* Clobber other flags */
Signature · 1 line
1.6.2.5