Commit 6f58332f by Russell Belfer

Fix use of uninitialized variable

parent a6a82e1a
...@@ -401,8 +401,8 @@ static int prepare_worktree_commit_message( ...@@ -401,8 +401,8 @@ static int prepare_worktree_commit_message(
git_buf buf = GIT_BUF_INIT; git_buf buf = GIT_BUF_INIT;
int error; int error;
if (git_buf_set(&buf, git_buf_cstr(msg), git_buf_len(msg)) < 0) if ((error = git_buf_set(&buf, git_buf_cstr(msg), git_buf_len(msg))) < 0)
return -1; return error;
git_buf_clear(msg); git_buf_clear(msg);
...@@ -419,7 +419,7 @@ static int prepare_worktree_commit_message( ...@@ -419,7 +419,7 @@ static int prepare_worktree_commit_message(
git_buf_printf(msg, ": %s\n", user_message); git_buf_printf(msg, ": %s\n", user_message);
} }
error = git_buf_oom(msg) || git_buf_oom(&buf) ? -1 : 0; error = (git_buf_oom(msg) || git_buf_oom(&buf)) ? -1 : 0;
cleanup: cleanup:
git_buf_free(&buf); git_buf_free(&buf);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment