Skip to contentSkip to conversation

Fix a filehandle leak

DISCUSSION Jon Loeliger 2 participants 3 messages Jul 14, 2010 – Jul 15, 2010 2 messages not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 43 lines

From: Martin Ettl <[email protected]>

During a check of the current git head of the linux kernel with the static code analysis tool cppcheck
(http://sourceforge.net/apps/mediawiki/cppcheck/index.php?title=Main_Page)
the tool discovered a resource leak in linux-2.6/scripts/dtc/fstree.c.

Please refer the attached patch, that fixes the issue.

Fixes https://bugzilla.kernel.org/show_bug.cgi?id=15363

---

Jon, please apply.

 scripts/dtc/fstree.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
scripts/dtc/fstree.c +1 -0
index 766b269..8fe1bdf 100644
@@ -77,6 +77,7 @@ static struct node *read_fstree(const char *dirname)
 		free(tmpnam);
 	}
 
+	closedir(d);
 	return tree;
 }
 
Signature · 8 lines
1.7.1

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _ot
her_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

Applied -p 3.

jdl

#3 lore raw
In reply to a message not in the archive
Quoted 1 line · Jon Loeliger
Quoted 1 line

From: Martin Ettl <[email protected]>

[snip]

Quoted 2 lines

Applied -p 3.

Ugh, sorry. Meant to mangle the patch to apply directly to the dtc tree, but I forgot.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#4 lore raw
Quoted 8 lines · Jon Loeliger
Quoted 1 line
Quoted 1 line

From: Martin Ettl <[email protected]>

[snip]

Quoted 2 lines

Applied -p 3.

Ugh, sorry. Meant to mangle the patch to apply directly to the dtc tree, but I forgot.

No worries.

jdl