]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
fd leaks: add an assert for the error extra data
authorPaul Floyd <pjfloyd@wanadoo.fr>
Sun, 28 Apr 2024 16:19:55 +0000 (18:19 +0200)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Sun, 28 Apr 2024 16:19:55 +0000 (18:19 +0200)
Coverity claims that it could cause a NULL dereference. I don't
think it's possible. Adding an assert will at least make things
clearer if Coverity ever turns out to be right.

coregrind/m_syswrap/syswrap-generic.c

index 0c0f67602b9c0af28231a242ce62dc90fa1335e7..48be8e8bf075db7947a69eb8f27e2744b4712bc2 100644 (file)
@@ -1128,6 +1128,7 @@ void fd_pp_Error (const Error *err)
       if (xml) VG_(emit)("  <kind>FdBadClose</kind>\n");
       struct BadCloseExtra *bce = (struct BadCloseExtra *)
          VG_(get_error_extra)(err);
+      vg_assert(bce);
       if (xml) {
          VG_(emit)("  <fd>%d</fd>\n", bce->fd);
          if (bce->pathname)