Signed-off-by: Rene Scharfe <l....@web.de>
---
 builtin/notes.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/builtin/notes.c b/builtin/notes.c
index 4303848e04..8e54f2d146 100644
--- a/builtin/notes.c
+++ b/builtin/notes.c
@@ -278,56 +278,57 @@ static int parse_reedit_arg(const struct option *opt, 
const char *arg, int unset
 static int notes_copy_from_stdin(int force, const char *rewrite_cmd)
 {
        struct strbuf buf = STRBUF_INIT;
        struct notes_rewrite_cfg *c = NULL;
        struct notes_tree *t = NULL;
        int ret = 0;
        const char *msg = "Notes added by 'git notes copy'";
 
        if (rewrite_cmd) {
                c = init_copy_notes_for_rewrite(rewrite_cmd);
                if (!c)
                        return 0;
        } else {
                init_notes(NULL, NULL, NULL, NOTES_INIT_WRITABLE);
                t = &default_notes_tree;
        }
 
        while (strbuf_getline_lf(&buf, stdin) != EOF) {
                struct object_id from_obj, to_obj;
                struct strbuf **split;
                int err;
 
                split = strbuf_split(&buf, ' ');
                if (!split[0] || !split[1])
                        die(_("malformed input line: '%s'."), buf.buf);
                strbuf_rtrim(split[0]);
                strbuf_rtrim(split[1]);
                if (get_oid(split[0]->buf, &from_obj))
                        die(_("failed to resolve '%s' as a valid ref."), 
split[0]->buf);
                if (get_oid(split[1]->buf, &to_obj))
                        die(_("failed to resolve '%s' as a valid ref."), 
split[1]->buf);
 
                if (rewrite_cmd)
                        err = copy_note_for_rewrite(c, &from_obj, &to_obj);
                else
                        err = copy_note(t, &from_obj, &to_obj, force,
                                        combine_notes_overwrite);
 
                if (err) {
                        error(_("failed to copy notes from '%s' to '%s'"),
                              split[0]->buf, split[1]->buf);
                        ret = 1;
                }
 
                strbuf_list_free(split);
        }
 
        if (!rewrite_cmd) {
                commit_notes(t, msg);
                free_notes(t);
        } else {
                finish_copy_notes_for_rewrite(c, msg);
        }
+       strbuf_release(&buf);
        return ret;
 }
 
-- 
2.14.1

Reply via email to