builtin/notes: remove unnecessary free
PATCH 1/1 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 <[email protected]>
--- builtin/notes.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
builtin/notes.c +1 -3
@@ -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);
Signature · 1 line
2.19.1.856.g8858448bb
Quoted 6 lines · Carlo Marcelo Arenas Belón
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 NULLSigned-off-by Carlo Marcelo Arenas Belón <[email protected]>
Signed-off-by Johan Herland <[email protected]>
Quoted 23 lines
--- builtin/notes.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)builtin/notes.c +1
-4@@ -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); --2.19.1.856.g8858448bb
Signature · 2 lines
Johan Herland, <[email protected]> www.herland.net
Quoted 6 lines · Johan Herland
Quoted 4 lines · Carlo Marcelo Arenas Belón
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
Wow, that's a old one.
Quoted 4 lines
Quoted 2 lines
Signed-off-by Carlo Marcelo Arenas Belón <[email protected]>Signed-off-by Johan Herland <[email protected]>
Thanks, both. Will apply.