linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] debugfs: don't try to fclose NULL
@ 2009-06-26 18:57 Eric Sandeen
  2009-06-29  5:07 ` Theodore Tso
  2009-06-30 15:44 ` Thierry Vignaud
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Sandeen @ 2009-06-26 18:57 UTC (permalink / raw)
  To: ext4 development

do_logdump may jump to errout if fopen(out_file) fails, 
but in that case out_file is NULL, and fclose will segfault.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/debugfs/logdump.c b/debugfs/logdump.c
index 4818bc6..9a7108a 100644
--- a/debugfs/logdump.c
+++ b/debugfs/logdump.c
@@ -259,7 +259,7 @@ void do_logdump(int argc, char **argv)
 		close(journal_fd);
 
 errout:
-	if (out_file != stdout)
+	if (out_file && (out_file != stdout))
 		fclose(out_file);
 
 	return;


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-06-30 17:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-26 18:57 [PATCH] debugfs: don't try to fclose NULL Eric Sandeen
2009-06-29  5:07 ` Theodore Tso
2009-06-30 15:44 ` Thierry Vignaud
2009-06-30 16:39   ` Theodore Tso
2009-06-30 16:46     ` Alex Buell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).