Do people want patches to quiet AddressSanitizer's leaks detector?

I've started testing my patches with AddressSanitizer.
By default, ASan produces many errors messages about memory
leaks in nmh.

All the leaks I have investigated have been benign leaks at
the end of main().  But there are so many false positives that
I cannot be sure there aren't some real leaks hiding in all
the noise.

Fixing these messages would also make it easier for others to
use ASan, because they would not have to learn how to make
ASan ignore possible memory leaks.  So it might help us find
bugs in the future.

On the negative side, the patches would be intrusive, making
small changes to most of the source files.  And they likely
wouldn't find any serious bugs right away.

So there are pros and cons.  What do people think?

Here's an example of the sort of changes I am proposing.
By making the variable "arguments" static instead of local
to main(), the allocations it points to do not appear to
be leaked when main() goes out of scope at the end of the
program's execution.


diff --git a/uip/burst.c b/uip/burst.c
index f209e52e..0df95c7e 100644
--- a/uip/burst.c
+++ b/uip/burst.c
@@ -68,6 +68,8 @@
 
 bool debugsw;
 
+static char **arguments;
+
 /*
  * static prototypes
  */
@@ -97,7 +99,7 @@ main (int argc, char **argv)
     int mimesw = 1;
     int hi, msgnum, numburst;
     char *cp, *maildir, *folder = NULL, buf[BUFSIZ];
-    char **argp, **arguments;
+    char **argp;
     struct msgs_array msgs = { 0, 0, NULL };
     struct smsg *smsgs;
     struct msgs *mp;


Reply via email to