m_cleanup: fix memory leaks
m_cleanup didn't cleanup the if_batchq and if_fastq queues, resulting in
a memory leak (reported by ASAN while fuzzing).
diff --git a/src/mbuf.c b/src/mbuf.c
index 54ec721..93c27b5 100644
--- a/src/mbuf.c
+++ b/src/mbuf.c
@@ -48,6 +48,18 @@
g_free(m);
m = next;
}
+ m = (struct mbuf *)slirp->if_batchq.qh_link;
+ while ((struct quehead *)m != &slirp->if_batchq) {
+ next = m->m_next;
+ g_free(m);
+ m = next;
+ }
+ m = (struct mbuf *)slirp->if_fastq.qh_link;
+ while ((struct quehead *)m != &slirp->if_fastq) {
+ next = m->m_next;
+ g_free(m);
+ m = next;
+ }
}
/*