2353: Fix file descriptor leak in kjs

thomas.*******@intra2******* (Google Code) (Is this you? Claim this profile.)
Oct. 26, 2011
Hi,

attached patch fixes a file descriptor leak in kjs::readFile().

Reported by "cppcheck".

Cheers,
Thomas
From 6858303132b1494794f6f81d86c8797ddf7435cd Mon Sep 17 00:00:00 2001
From: Thomas Jarosch <thomas.jarosch@intra2net.com>
Date: Wed, 26 Oct 2011 20:47:10 +0200
Subject: [PATCH] Fix file descriptor leak
Detected by "cppcheck"
Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
---
 kjs/kjs.cpp |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/kjs/kjs.cpp b/kjs/kjs.cpp
index c9c6501..3e8ebfa 100644
--- a/kjs/kjs.cpp
+++ b/kjs/kjs.cpp
@@ -86,6 +86,7 @@ static UString readFile(const char* fileName)
     }
     c[dataRead] = '\0';
     UString s = c;
+    close(fd);
     delete[] c;
     return s;
 }
-- 
1.7.6.4
david
#1 david
I think you posted this to the wrong bug tracker. This tracker is for the Review Board code review tool.
  • +Invalid
#2 thomas.*******@intra2******* (Google Code) (Is this you? Claim this profile.)
On Thursday, 27. October 2011 01:37:55 you wrote:

Oh well, I went to https://git.reviewboard.kde.org and clicked
on "Report bug". I already wondered why the link went to code.google.com.

It's a bit confusing to have a "Report Bug" and "Bugs" link
on the actual reviewboard installed on a site.