diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2024-04-24 02:39:25 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2024-04-24 02:39:40 +0200 |
commit | 41b92e2731933a820658fc6e9a69732bf30e6635 (patch) | |
tree | bbd0c7f661f8c75d448de823631ca65104f47a55 | |
parent | c195d025b031f458acb2e603395afd49b19f0a2a (diff) | |
download | slirp-41b92e2731933a820658fc6e9a69732bf30e6635.zip slirp-41b92e2731933a820658fc6e9a69732bf30e6635.tar.gz slirp-41b92e2731933a820658fc6e9a69732bf30e6635.tar.bz2 |
mbuf: Be extra careful with freed pointer
As coverity reports, we are not supposed to do anything with a freed
pointer, not even assigning it to m. So break the loop before doing so.
-rw-r--r-- | src/mbuf.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -39,7 +39,7 @@ static void m_cleanup_list(struct slirp_quehead *list_head, bool pkts) next = m->m_next; last = false; - do { + while (1) { next2 = m->m_nextpkt; if (pkts) { @@ -54,8 +54,11 @@ static void m_cleanup_list(struct slirp_quehead *list_head, bool pkts) } g_free(m); + + if (last) + break; m = next2; - } while (!last); + }; m = next; } |