]> git.proxmox.com Git - libgit2.git/commitdiff
refspec: check buffer with GITERR_CHECK_ALLOC_BUF
authorPatrick Steinhardt <ps@pks.im>
Tue, 23 Feb 2016 09:09:03 +0000 (10:09 +0100)
committerPatrick Steinhardt <ps@pks.im>
Tue, 23 Feb 2016 10:50:23 +0000 (11:50 +0100)
src/refspec.c

index f92a6d2b61776260624dbe30bd7f85aa7d335cca..debde8692ca794a1b57df804b6c856246c853cb2 100644 (file)
@@ -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)) {
                for (j = 0; formatters[j]; j++) {
                        git_buf_clear(&buf);
-                       if (git_buf_printf(&buf, formatters[j], spec->src) < 0)
-                               return -1;
+                       git_buf_printf(&buf, formatters[j], spec->src);
+                       GITERR_CHECK_ALLOC_BUF(&buf);
 
                        key.name = (char *) git_buf_cstr(&buf);
                        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)
                        git_buf_puts(&buf, GIT_REFS_HEADS_DIR);
                }
 
-               if (git_buf_puts(&buf, spec->dst) < 0)
-                       return -1;
+               git_buf_puts(&buf, spec->dst);
+               GITERR_CHECK_ALLOC_BUF(&buf);
 
                cur->dst = git_buf_detach(&buf);
        }