diff options
author | Andrew Tridgell <tridge@samba.org> | 2009-09-17 16:42:11 -0700 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2009-09-17 21:52:28 -0700 |
commit | 78338d431c6e4ae8e3ff94b0ba9caaae2a5626a9 (patch) | |
tree | bd0abe1a3387a456700bc5bd330be24a3ff62764 | |
parent | a3f33356bbad2eb9d8b084a46533e9f0b9b940c9 (diff) | |
download | samba-78338d431c6e4ae8e3ff94b0ba9caaae2a5626a9.tar.gz samba-78338d431c6e4ae8e3ff94b0ba9caaae2a5626a9.tar.bz2 samba-78338d431c6e4ae8e3ff94b0ba9caaae2a5626a9.zip |
talloc: don't crash if f is NULL in talloc_report_*
It's annoying when you use
p talloc_report_full(ctx, fopen("/tmp/xx","w"))
in gdb, and if you don't have write permission on the file then
you get a segv.
-rw-r--r-- | lib/talloc/talloc.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/talloc/talloc.c b/lib/talloc/talloc.c index 478767c955..f103a9b941 100644 --- a/lib/talloc/talloc.c +++ b/lib/talloc/talloc.c @@ -1421,8 +1421,10 @@ static void talloc_report_depth_FILE_helper(const void *ptr, int depth, int max_ */ void talloc_report_depth_file(const void *ptr, int depth, int max_depth, FILE *f) { - talloc_report_depth_cb(ptr, depth, max_depth, talloc_report_depth_FILE_helper, f); - fflush(f); + if (f) { + talloc_report_depth_cb(ptr, depth, max_depth, talloc_report_depth_FILE_helper, f); + fflush(f); + } } /* |