diff options
author | Patrick Steinhardt <ps@pks.im> | 2020-09-18 10:34:40 +0200 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2020-09-18 10:34:40 +0200 |
commit | 819492c15435efc4a2e7278ba72a2888692f60de (patch) | |
tree | 538895d4f7c3198ddf48c20f7d02138c5170722f /src/refs.c | |
parent | 9e81711bace51b1d3e233675c85b289743f5fdd7 (diff) | |
download | libgit2-819492c15435efc4a2e7278ba72a2888692f60de.tar.gz |
refs: fix potential free of uninitialized variable
The `signature` variable in `git_reference_rename` isn't initialized and
neither does `git_reference__log_signature` always do. So if the latter
function fails, we'll call `git_signature_free` on this unininitialized
variable.
Fix the issue by initializing the pointer with `NULL`.
Diffstat (limited to 'src/refs.c')
-rw-r--r-- | src/refs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/refs.c b/src/refs.c index ed900577d..51635a9e4 100644 --- a/src/refs.c +++ b/src/refs.c @@ -606,7 +606,7 @@ int git_reference_rename( const char *log_message) { refs_update_head_payload payload; - git_signature *signature; + git_signature *signature = NULL; git_repository *repo; int error; |