about summary refs log tree commit diff
path: root/ui-log.c
diff options
context:
space:
mode:
authorJohn Keeping <john@keeping.me.uk>2016-01-16 11:03:05 +0000
committerJason A. Donenfeld <Jason@zx2c4.com>2016-01-17 17:05:00 +0100
commitbaa5ad1f80f56d3c0b0095bfb468fab28c9b4982 (patch)
tree5e23e5f9ebf7bbccbf431e056588442f1a8b924c /ui-log.c
parentBump version (diff)
downloadcgit-pink-baa5ad1f80f56d3c0b0095bfb468fab28c9b4982.tar.gz
cgit-pink-baa5ad1f80f56d3c0b0095bfb468fab28c9b4982.zip
ui-log: handle parse_commit() errors
If parse_commit() fails, none of the fields in the commit structure will
have been populated so we will dereference NULL when accessing
item->tree.

There isn't much we can do about the error at this point, but if we
return true then we'll try parsing the commit again from print_commit()
and we can report an error to the user at that point.

Coverity-id: 13801
Signed-off-by: John Keeping <john@keeping.me.uk>
Diffstat (limited to '')
-rw-r--r--ui-log.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ui-log.c b/ui-log.c
index 4573255..a4dc707 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -141,7 +141,9 @@ static int show_commit(struct commit *commit, struct rev_info *revs)
 
 	/* When we get here we have precisely one parent. */
 	parent = parents->item;
-	parse_commit(parent);
+	/* If we can't parse the commit, let print_commit() report an error. */
+	if (parse_commit(parent))
+		return 1;
 
 	files = 0;
 	add_lines = 0;
/exman.1?id=25d251606b5243ba03e1e0b20ba61967728db38e&follow=1'>Update to OpenBSD 7.0 2062.63June McEnroe 2021-08-29Update to Linux man-pages 5.13 2062.53Štěpán Němec 2021-08-26Update to NetBSD 9.2 2062.52June McEnroe 2021-08-26Support DESTDIR in install/uninstallJune McEnroe 2021-08-26Add version number generatorJune McEnroe 2021-08-22Add ISC license headerJune McEnroe 2021-08-22Update to Linux man-pages 5.12Štěpán Němec 2021-06-21Add manuals for macOS 11.3June McEnroe 2021-05-08Update to OpenBSD 6.9June McEnroe 2021-04-26Update to Linux man-pages 5.11June McEnroe 2021-04-26Update to FreeBSD 13.0June McEnroe 2021-01-27Completely rewrite how manuals are fetched and installedJune McEnroe 2020-12-14Update to man-pages-posix 2017-aJune McEnroe 2020-12-14Update to OpenBSD 6.8June McEnroe 2020-12-14Update to NetBSD 9.1June McEnroe 2020-12-14Update to man-pages 5.09June McEnroe 2020-12-14Update to FreeBSD 12.2June McEnroe 2020-06-08Update to OpenBSD 6.7June McEnroe 2020-05-04Add hack for macOS to search extra man sectionsJune McEnroe 2020-05-04Don't clear MANSECTJune McEnroe