From 59bb6880331399337498d768feccbdc8162bdbeb Mon Sep 17 00:00:00 2001 From: Andrey Vagin Date: Fri, 1 May 2015 14:06:00 +0300 Subject: [PATCH] kerdat: don't leak a file descriptor 288 if (flock(fd, LOCK_SH)) { 289 pr_perror("Can't take a lock\n"); >>> >>> CID 92726: Resource leaks (RESOURCE_LEAK) >>> >>> Handle variable "fd" going out of scope leaks the handle. 290 return -1; 291 } Signed-off-by: Andrey Vagin Signed-off-by: Pavel Emelyanov --- kerndat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kerndat.c b/kerndat.c index 291402843..b07580285 100644 --- a/kerndat.c +++ b/kerndat.c @@ -287,7 +287,7 @@ int kerndat_fdinfo_has_lock() if (flock(fd, LOCK_SH)) { pr_perror("Can't take a lock"); - return -1; + goto out; } pfd = open_proc(PROC_SELF, "fdinfo/%d", fd);