[PATCH] debugfs: don't try to fclose NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---

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;

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux