Skip to content

Commit 819492c

Browse files
committed
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`.
1 parent 9e81711 commit 819492c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/refs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ int git_reference_rename(
606606
const char *log_message)
607607
{
608608
refs_update_head_payload payload;
609-
git_signature *signature;
609+
git_signature *signature = NULL;
610610
git_repository *repo;
611611
int error;
612612

0 commit comments

Comments
 (0)