[klibc] [PATCH 2/2] nfsmounf: start_dummy_portmap() close fd on error path
maximilian attems
max at stro.at
Sun Nov 14 02:48:56 PST 2010
fix ressource leakage.
Signed-off-by: maximilian attems <max at stro.at>
---
usr/kinit/nfsmount/dummypmap.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/usr/kinit/nfsmount/dummypmap.c b/usr/kinit/nfsmount/dummypmap.c
index 43abe37..e5ebef9 100644
--- a/usr/kinit/nfsmount/dummypmap.c
+++ b/usr/kinit/nfsmount/dummypmap.c
@@ -249,6 +249,7 @@ pid_t start_dummy_portmap(const char *file)
if (errno == EINVAL || errno == EADDRINUSE)
return 0; /* Assume not needed */
else {
+ fclose(portmap_filep);
fprintf(stderr, "%s: portmap spoofing failed\n",
progname);
return -1;
@@ -257,6 +258,7 @@ pid_t start_dummy_portmap(const char *file)
spoof_portmap = fork();
if (spoof_portmap == -1) {
+ fclose(portmap_filep);
fprintf(stderr, "%s: cannot fork\n", progname);
return -1;
} else if (spoof_portmap == 0) {
--
1.7.2.3
More information about the klibc
mailing list