aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2023-04-26 16:11:30 -0700
committerVitaly Buka <vitalybuka@google.com>2023-04-26 16:13:57 -0700
commit1533478615e998192e227bded9d0e9029474936b (patch)
tree2cc490d083a341cfae2397a47f260c4c21201569
parentd36d0cbd716a15fb1f77a3c13cd6d4aaff8b3d95 (diff)
downloadllvm-1533478615e998192e227bded9d0e9029474936b.zip
llvm-1533478615e998192e227bded9d0e9029474936b.tar.gz
llvm-1533478615e998192e227bded9d0e9029474936b.tar.bz2
[test][HWASAN] Suppress memory leak in getpass
Reported after D149234.
-rw-r--r--compiler-rt/test/sanitizer_common/TestCases/Posix/getpass.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/getpass.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/getpass.cpp
index 201b47a..4814bb1 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);
}