summaryrefslogtreecommitdiff
path: root/src/debug.c
diff options
context:
space:
mode:
authorfootpatch <voetpatch@gmail.com>2022-02-06 06:17:38 -0500
committerGitHub <noreply@github.com>2022-02-06 13:17:38 +0200
commit91cc2059f5566ca7d22557df7fe47860d93d0009 (patch)
treede011ebab949227313df44e84e65fc6a1b4495fb /src/debug.c
parent344e41c92228f3b8aade6220c48b7d8c6e7817a7 (diff)
downloadredis-91cc2059f5566ca7d22557df7fe47860d93d0009.tar.gz
Fix file descriptor leak in memtest_test_linux_anonymous_maps (#4241)
when we fail opening `/proc`, we need to close the log file fd.
Diffstat (limited to 'src/debug.c')
-rw-r--r--src/debug.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/debug.c b/src/debug.c
index 146460646..305941586 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -1764,7 +1764,10 @@ int memtest_test_linux_anonymous_maps(void) {
if (!fd) return 0;
fp = fopen("/proc/self/maps","r");
- if (!fp) return 0;
+ if (!fp) {
+ closeDirectLogFiledes(fd);
+ return 0;
+ }
while(fgets(line,sizeof(line),fp) != NULL) {
char *start, *end, *p = line;