scripts/dtc: Fix a resource leak
authorMartin Ettl <ettl.martin@gmx.de>
Sun, 21 Feb 2010 08:31:44 +0000 (09:31 +0100)
committerMichal Marek <mmarek@suse.cz>
Fri, 2 Jul 2010 11:51:11 +0000 (13:51 +0200)
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
Signed-off-by: Martin Ettl <ettl.martin@gmx.de>
Cc: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Michal Marek <mmarek@suse.cz>
scripts/dtc/fstree.c

index 766b2694d93589fe39ea6313dbae7b1ce5a21daa..8fe1bdf239f0f7a4d1e40baadf9cd8430c5176aa 100644 (file)
@@ -77,6 +77,7 @@ static struct node *read_fstree(const char *dirname)
                free(tmpnam);
        }
 
+       closedir(d);
        return tree;
 }