[compiler-rt] 1533478 - [test][HWASAN] Suppress memory leak in getpass

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 26 16:15:29 PDT 2023


Author: Vitaly Buka
Date: 2023-04-26T16:13:57-07:00
New Revision: 1533478615e998192e227bded9d0e9029474936b

URL: https://github.com/llvm/llvm-project/commit/1533478615e998192e227bded9d0e9029474936b
DIFF: https://github.com/llvm/llvm-project/commit/1533478615e998192e227bded9d0e9029474936b.diff

LOG: [test][HWASAN] Suppress memory leak in getpass

Reported after D149234.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/getpass.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/getpass.cpp
index 201b47a7aa27..4814bb1a9c6e 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Posix/getpass.cpp
+++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/getpass.cpp
@@ -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);
   }


        


More information about the llvm-commits mailing list