Commit b9f28b8d by Patrick Steinhardt

refspec: check buffer with GITERR_CHECK_ALLOC_BUF

parent c5bd70d1
...@@ -323,8 +323,8 @@ int git_refspec__dwim_one(git_vector *out, git_refspec *spec, git_vector *refs) ...@@ -323,8 +323,8 @@ int git_refspec__dwim_one(git_vector *out, git_refspec *spec, git_vector *refs)
if (git__prefixcmp(spec->src, GIT_REFS_DIR)) { if (git__prefixcmp(spec->src, GIT_REFS_DIR)) {
for (j = 0; formatters[j]; j++) { for (j = 0; formatters[j]; j++) {
git_buf_clear(&buf); git_buf_clear(&buf);
if (git_buf_printf(&buf, formatters[j], spec->src) < 0) git_buf_printf(&buf, formatters[j], spec->src);
return -1; GITERR_CHECK_ALLOC_BUF(&buf);
key.name = (char *) git_buf_cstr(&buf); key.name = (char *) git_buf_cstr(&buf);
if (!git_vector_search(&pos, refs, &key)) { if (!git_vector_search(&pos, refs, &key)) {
...@@ -348,8 +348,8 @@ int git_refspec__dwim_one(git_vector *out, git_refspec *spec, git_vector *refs) ...@@ -348,8 +348,8 @@ int git_refspec__dwim_one(git_vector *out, git_refspec *spec, git_vector *refs)
git_buf_puts(&buf, GIT_REFS_HEADS_DIR); git_buf_puts(&buf, GIT_REFS_HEADS_DIR);
} }
if (git_buf_puts(&buf, spec->dst) < 0) git_buf_puts(&buf, spec->dst);
return -1; GITERR_CHECK_ALLOC_BUF(&buf);
cur->dst = git_buf_detach(&buf); cur->dst = git_buf_detach(&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