summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2016-02-22 14:06:48 +0100
committerPatrick Steinhardt <ps@pks.im>2016-02-23 11:50:23 +0100
commit793e0855365bbabfeffbd730fd9ee5ee9a011546 (patch)
treefa0d77b1b0f96a90f86147c49a8008a8eacd56c1
parentbe8479c9873315afcf6b86f0b1bb79052a23b363 (diff)
downloadlibgit2-793e0855365bbabfeffbd730fd9ee5ee9a011546.tar.gz
refdb_fs: remove unnecessary check for NULL
The fail-label of `reflog_parse` explicitly checks the entry poitner for NULL before freeing it. When we jump to the label the variable has to be set to a non-NULL and valid pointer though: if the allocation fails we immediately return with an error code and if the loop was not entered we return with a success code, withouth executing the label's code. Remove the useless NULL-check to silence Coverity.
-rw-r--r--src/refdb_fs.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/refdb_fs.c b/src/refdb_fs.c
index 1348c67a1..f6ed7201a 100644
--- a/src/refdb_fs.c
+++ b/src/refdb_fs.c
@@ -1512,8 +1512,7 @@ static int reflog_parse(git_reflog *log, const char *buf, size_t buf_size)
#undef seek_forward
fail:
- if (entry)
- git_reflog_entry__free(entry);
+ git_reflog_entry__free(entry);
return -1;
}