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>
Carlo Marcelo Arenas Belón committed
Nov 11, 2018 at 01:49 UTC
9a4cb8781e4eec0445e7f3b693aa3589436255b9
1 file changed
+1
-3
builtin/notes.c
+1
-3
@@ -255,10 +255,8 @@ static int parse_reuse_arg(const struct option *opt, const char *arg, int unset)
255
256
if (get_oid(arg, &object))
257
die(_("failed to resolve '%s' as a valid ref."), arg);
258
- if (!(buf = read_object_file(&object, &type, &len))) {
259
- free(buf);
258
+ if (!(buf = read_object_file(&object, &type, &len)))
259
die(_("failed to read object '%s'."), arg);
261
- }
260
if (type != OBJ_BLOB) {
261
free(buf);
262
die(_("cannot read note data from non-blob object '%s'."), arg);