OSDN Git Service

debugfs: don't try to fclose NULL
authorEric Sandeen <sandeen@redhat.com>
Fri, 26 Jun 2009 18:57:39 +0000 (13:57 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 29 Jun 2009 05:07:29 +0000 (01:07 -0400)
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>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
debugfs/logdump.c

index 4818bc6..9a7108a 100644 (file)
@@ -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;