[Git][slirp/libslirp][master] mbuf: Be extra careful with freed pointer

Samuel Thibault (@sthibaul) gitlab at gitlab.freedesktop.org
Wed Apr 24 00:39:52 UTC 2024



Samuel Thibault pushed to branch master at slirp / libslirp


Commits:
41b92e27 by Samuel Thibault at 2024-04-24T02:39:40+02:00
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.

- - - - -


1 changed file:

- src/mbuf.c


Changes:

=====================================
src/mbuf.c
=====================================
@@ -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;
     }



View it on GitLab: https://gitlab.freedesktop.org/slirp/libslirp/-/commit/41b92e2731933a820658fc6e9a69732bf30e6635

-- 
View it on GitLab: https://gitlab.freedesktop.org/slirp/libslirp/-/commit/41b92e2731933a820658fc6e9a69732bf30e6635
You're receiving this email because of your account on gitlab.freedesktop.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/slirp/attachments/20240424/8ba2c1a7/attachment-0001.htm>


More information about the Slirp mailing list