Introduction
Introduction Statistics Contact Development Disclaimer Help
handledir: fix memory leak if writing a directory entry failed - geomyidae - a …
git clone git://git.codemadness.org/geomyidae
Log
Files
Refs
README
LICENSE
---
commit 70d5d67d68410c852d9663a6e4935e508897ffdf
parent 9526d3d35917770ca5a021d745bcf50d382875b2
Author: Hiltjo Posthuma <[email protected]>
Date: Wed, 8 Mar 2023 20:55:16 +0100
handledir: fix memory leak if writing a directory entry failed
Signed-off-by: Christoph Lohmann <[email protected]>
Diffstat:
M handlr.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/handlr.c b/handlr.c
@@ -67,10 +67,8 @@ handledir(int sock, char *path, char *port, char *base, char…
return;
} else {
for (i = 0; i < ndir && ret >= 0; i++) {
- if (dirent[i]->d_name[0] == '.') {
- free(dirent[i]);
+ if (dirent[i]->d_name[0] == '.')
continue;
- }
type = gettype(dirent[i]->d_name);
file = smprintf("%s%s%s", pa,
@@ -87,8 +85,9 @@ handledir(int sock, char *path, char *port, char *base, char …
humantime(&(st.st_mtime)),
e, ohost, port);
free(file);
- free(dirent[i]);
}
+ for (i = 0; i < ndir; i++)
+ free(dirent[i]);
free(dirent);
}
dprintf(sock, ".\r\n");
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.