From: Eric Sandeen Date: Fri, 26 Jun 2009 18:57:39 +0000 (-0500) Subject: debugfs: don't try to fclose NULL X-Git-Tag: v1.41.7~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dad0bab204a61c1749e1bbc747f8fa86fa0f1577;p=thirdparty%2Fe2fsprogs.git debugfs: don't try to fclose NULL 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 Signed-off-by: Theodore Ts'o --- diff --git a/debugfs/logdump.c b/debugfs/logdump.c index 4818bc65b..9a7108a66 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;