From 80c13749140284abdc23bbeed2507b7e5a3dc459 Mon Sep 17 00:00:00 2001 From: Jeff Dike Date: Fri, 29 Sep 2006 01:58:51 -0700 Subject: [PATCH] uml: close file descriptor leaks Close two file descriptor leaks, one in the ubd driver and one to /proc/mounts. The ubd driver bug also leaked some vmalloc space. The /proc/mounts leak was a descriptor that was just never closed. Signed-off-by: Jeff Dike Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/um/os-Linux/mem.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'arch/um/os-Linux') diff --git a/arch/um/os-Linux/mem.c b/arch/um/os-Linux/mem.c index b170b47..4203681 100644 --- a/arch/um/os-Linux/mem.c +++ b/arch/um/os-Linux/mem.c @@ -132,6 +132,9 @@ err: else if(found < 0) printf("read returned errno %d\n", -found); +out: + close(fd); + return; found: @@ -141,11 +144,12 @@ found: if(strncmp(buf, "tmpfs", strlen("tmpfs"))){ printf("not tmpfs\n"); - return; + goto out; } printf("OK\n"); default_tmpdir = "/dev/shm"; + goto out; } /* -- cgit v1.1