aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjeremy marchand <jeremy.marchand@etu.u-bordeaux.fr>2021-02-18 14:28:40 +0100
committerjeremy marchand <jeremy.marchand@etu.u-bordeaux.fr>2021-02-18 14:28:40 +0100
commitec1dfcef5b3748df96ae464ad5be935a91d1b319 (patch)
tree693679dcd8194f733a5da2a0e60ac0df5a7956cb
parent99b3b70af627980ee3490944c702b42fc855ef2a (diff)
downloadslirp-memory_leaks.zip
slirp-memory_leaks.tar.gz
slirp-memory_leaks.tar.bz2
m_cleanup: fix memory leaksmemory_leaks
m_cleanup didn't cleanup the if_batchq and if_fastq queues, resulting in a memory leak (reported by ASAN while fuzzing).
-rw-r--r--src/mbuf.c12
1 files changed, 12 insertions, 0 deletions
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 @@ void m_cleanup(Slirp *slirp)
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;
+ }
}
/*