]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'cb/notes-freeing-always-null-fix'
authorJunio C Hamano <gitster@pobox.com>
Sun, 18 Nov 2018 09:23:57 +0000 (18:23 +0900)
committerJunio C Hamano <gitster@pobox.com>
Sun, 18 Nov 2018 09:23:57 +0000 (18:23 +0900)
Code cleanup.

* cb/notes-freeing-always-null-fix:
  builtin/notes: remove unnecessary free

1  2 
builtin/notes.c

diff --combined builtin/notes.c
index 91faa514aaa7f83b06f8ffc9599164c366c394fb,68062f747511cb6f2859ddc64a09809602373ed8..c78b7a0c5b7fbea81320ae9873553c437d82e73e
@@@ -215,8 -215,6 +215,8 @@@ static int parse_msg_arg(const struct o
  {
        struct note_data *d = opt->value;
  
 +      BUG_ON_OPT_NEG(unset);
 +
        strbuf_grow(&d->buf, strlen(arg) + 2);
        if (d->buf.len)
                strbuf_addch(&d->buf, '\n');
@@@ -231,8 -229,6 +231,8 @@@ static int parse_file_arg(const struct 
  {
        struct note_data *d = opt->value;
  
 +      BUG_ON_OPT_NEG(unset);
 +
        if (d->buf.len)
                strbuf_addch(&d->buf, '\n');
        if (!strcmp(arg, "-")) {
@@@ -254,17 -250,13 +254,15 @@@ static int parse_reuse_arg(const struc
        enum object_type type;
        unsigned long len;
  
 +      BUG_ON_OPT_NEG(unset);
 +
        if (d->buf.len)
                strbuf_addch(&d->buf, '\n');
  
        if (get_oid(arg, &object))
                die(_("failed to resolve '%s' as a valid ref."), arg);
-       if (!(buf = read_object_file(&object, &type, &len))) {
-               free(buf);
+       if (!(buf = read_object_file(&object, &type, &len)))
                die(_("failed to read object '%s'."), arg);
-       }
        if (type != OBJ_BLOB) {
                free(buf);
                die(_("cannot read note data from non-blob object '%s'."), arg);
  static int parse_reedit_arg(const struct option *opt, const char *arg, int unset)
  {
        struct note_data *d = opt->value;
 +      BUG_ON_OPT_NEG(unset);
        d->use_editor = 1;
        return parse_reuse_arg(opt, arg, unset);
  }