diff options
author | John Keeping | 2016-01-16 11:03:05 +0000 |
---|---|---|
committer | Jason A. Donenfeld | 2016-01-17 17:05:00 +0100 |
commit | baa5ad1f80f56d3c0b0095bfb468fab28c9b4982 (patch) | |
tree | 5e23e5f9ebf7bbccbf431e056588442f1a8b924c | |
parent | e64d5e04c3e22e713539da2b06e1052390aed43d (diff) | |
download | cgit-baa5ad1f80f56d3c0b0095bfb468fab28c9b4982.tar.gz cgit-baa5ad1f80f56d3c0b0095bfb468fab28c9b4982.tar.bz2 cgit-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>
-rw-r--r-- | ui-log.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -141,7 +141,9 @@ static int show_commit(struct commit *commit, struct rev_info *revs) | |||
141 | 141 | ||
142 | /* When we get here we have precisely one parent. */ | 142 | /* When we get here we have precisely one parent. */ |
143 | parent = parents->item; | 143 | parent = parents->item; |
144 | parse_commit(parent); | 144 | /* If we can't parse the commit, let print_commit() report an error. */ |
145 | if (parse_commit(parent)) | ||
146 | return 1; | ||
145 | 147 | ||
146 | files = 0; | 148 | files = 0; |
147 | add_lines = 0; | 149 | add_lines = 0; |