Browse Source

builtin/notes: remove unnecessary free

511726e4b1 ("builtin/notes: fix premature failure when trying to add
the empty blob", 2014-11-09) removed the check for !len but left a
call to free the buffer that will be otherwise NULL

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Acked-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Carlo Marcelo Arenas Belón 6 years ago committed by Junio C Hamano
parent
commit
9a4cb8781e
  1. 4
      builtin/notes.c

4
builtin/notes.c

@ -255,10 +255,8 @@ static int parse_reuse_arg(const struct option *opt, const char *arg, int unset) @@ -255,10 +255,8 @@ static int parse_reuse_arg(const struct option *opt, const char *arg, int unset)

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);

Loading…
Cancel
Save