From 2b8f61393e0b99e36e292880f6b8da66317176a1 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Tue, 5 May 2015 15:31:11 -0700 Subject: [PATCH] tunfile_open(): don't leak fd on error path Reported by Coverity, CID 51640. Signed-off-by: Kir Kolyshkin Acked-by: Andrew Vagin Signed-off-by: Pavel Emelyanov --- tun.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tun.c b/tun.c index e4c9bb6b7..aeca62b2a 100644 --- a/tun.c +++ b/tun.c @@ -342,7 +342,7 @@ static int tunfile_open(struct file_desc *d) tl = find_tun_link(ti->tfe->netdev); if (!tl) { pr_err("No tun device for file %s\n", ti->tfe->netdev); - return -1; + goto err; } memset(&ifr, 0, sizeof(ifr));