fix ressource leak of fd. Signed-off-by: maximilian attems <max at stro.at> --- usr/klibc/tests/fcntl.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/usr/klibc/tests/fcntl.c b/usr/klibc/tests/fcntl.c index 97aa3a7..b2bdbdf 100644 --- a/usr/klibc/tests/fcntl.c +++ b/usr/klibc/tests/fcntl.c @@ -46,5 +46,6 @@ int main(int argc, char *argv[]) /* Eventually, fork and try to conflict with this lock... */ + close(fd); return 0; } -- 1.7.2.3
maximilian attems
2010-Nov-10 14:45 UTC
[klibc] [PATCH 2/2] kinit: ramdisk_load() fix leakage on error path
close respective file descriptor and stream.
Signed-off-by: maximilian attems <max at stro.at>
---
usr/kinit/ramdisk_load.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/usr/kinit/ramdisk_load.c b/usr/kinit/ramdisk_load.c
index 7315008..ac2eaac 100644
--- a/usr/kinit/ramdisk_load.c
+++ b/usr/kinit/ramdisk_load.c
@@ -243,6 +243,8 @@ int ramdisk_load(int argc, char *argv[])
(fssize == 0 && !(is_gzip = !strcmp(fstype, "gzip")))) {
fprintf(stderr,
"Failure loading ramdisk: unknown filesystem type\n");
+ close(rfd);
+ fclose(wfd);
return 0;
}
--
1.7.2.3