Skip to contentSkip to conversation

ibsysstat.c: fix resource leak

PATCH Applied Hal Rosenstock 2 participants 2 messages Jun 12, 2013 1 message not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 4/6 ibsysstat.c: fix resource leak

From: Dan Ben Yosef <[email protected]>

Memory leak.

---
 src/ibsysstat.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
src/ibsysstat.c +3 -1
index eb876d4..c1438c1 100644
@@ -271,8 +271,10 @@ int build_cpuinfo(void)
 	while (fgets(line, sizeof(line) - 1, f)) {
 		if (!strncmp(line, "processor\t", 10)) {
 			ncpu++;
-			if (ncpu > MAX_CPUS)
+			if (ncpu > MAX_CPUS) {
+				fclose(f);
 				return MAX_CPUS;
+			}
 			continue;
 		}
 
Signature · 6 lines
1.7.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 51B87DDF.1090205-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org

Applied
#2 lore raw
Quoted 1 line · On Wed, 12 Jun 2013 09:55:43 -0400 Hal Rosenstock…

From: Dan Ben Yosef <[email protected]>

Thanks applied!
Ira

Quoted 28 lines

Memory leak.

---
 src/ibsysstat.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
src/ibsysstat.c +3 -1
index eb876d4..c1438c1 100644
@@ -271,8 +271,10 @@ int build_cpuinfo(void)
 	while (fgets(line, sizeof(line) - 1, f)) {
 		if (!strncmp(line, "processor\t", 10)) {
 			ncpu++;
-			if (ncpu > MAX_CPUS)
+			if (ncpu > MAX_CPUS) {
+				fclose(f);
 				return MAX_CPUS;
+			}
 			continue;
 		}
 
Signature · 1 line
1.7.8.2
Signature · 5 lines
Ira Weiny <[email protected]>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html