[test][HWASAN] Suppress memory leak in getpass
authorVitaly Buka <vitalybuka@google.com>
Wed, 26 Apr 2023 23:11:30 +0000 (16:11 -0700)
committerVitaly Buka <vitalybuka@google.com>
Wed, 26 Apr 2023 23:13:57 +0000 (16:13 -0700)
Reported after D149234.

compiler-rt/test/sanitizer_common/TestCases/Posix/getpass.cpp

index 201b47a..4814bb1 100644 (file)
@@ -23,6 +23,8 @@
 #endif
 #include <unistd.h>
 
+char *s; // getpass leaks.
+
 int main(int argc, char **argv) {
   int m;
   int pid = forkpty(&m, NULL, NULL, NULL);
@@ -38,7 +40,7 @@ int main(int argc, char **argv) {
     while ((res = read(m, buf, sizeof(buf))) > 0)
       write(1, buf, res);
   } else {
-    char *s = getpass("prompt");
+    s = getpass("prompt");
     assert(strcmp(s, "password") == 0);
     write(1, "done\n", 5);
   }