mirror of
https://git.zx2c4.com/cgit
synced 2024-11-26 02:18:42 +00:00
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>
This commit is contained in:
parent
e64d5e04c3
commit
baa5ad1f80
4
ui-log.c
4
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. */
|
/* When we get here we have precisely one parent. */
|
||||||
parent = parents->item;
|
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;
|
files = 0;
|
||||||
add_lines = 0;
|
add_lines = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user