* [PATCH] builtin/notes: remove unnecessary free
@ 2018-11-11 9:49 Carlo Marcelo Arenas Belón
2018-11-11 10:41 ` Johan Herland
0 siblings, 1 reply; 3+ messages in thread
From: Carlo Marcelo Arenas Belón @ 2018-11-11 9:49 UTC (permalink / raw)
To: git; +Cc: johan
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>
---
builtin/notes.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/builtin/notes.c b/builtin/notes.c
index c05cd004ab..68062f7475 100644
--- a/builtin/notes.c
+++ b/builtin/notes.c
@@ -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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] builtin/notes: remove unnecessary free
2018-11-11 9:49 [PATCH] builtin/notes: remove unnecessary free Carlo Marcelo Arenas Belón
@ 2018-11-11 10:41 ` Johan Herland
2018-11-13 1:29 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Johan Herland @ 2018-11-11 10:41 UTC (permalink / raw)
To: carenas; +Cc: Git mailing list
On Sun, Nov 11, 2018 at 10:49 AM Carlo Marcelo Arenas Belón
<carenas@gmail.com> wrote:
>
> 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>
Signed-off-by: Johan Herland <johan@herland.net>
> ---
> builtin/notes.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/builtin/notes.c b/builtin/notes.c
> index c05cd004ab..68062f7475 100644
> --- a/builtin/notes.c
> +++ b/builtin/notes.c
> @@ -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
>
--
Johan Herland, <johan@herland.net>
www.herland.net
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] builtin/notes: remove unnecessary free
2018-11-11 10:41 ` Johan Herland
@ 2018-11-13 1:29 ` Junio C Hamano
0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2018-11-13 1:29 UTC (permalink / raw)
To: Johan Herland; +Cc: carenas, Git mailing list
Johan Herland <johan@herland.net> writes:
> On Sun, Nov 11, 2018 at 10:49 AM Carlo Marcelo Arenas Belón
> <carenas@gmail.com> wrote:
>>
>> 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.
>>
>> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
>
> Signed-off-by: Johan Herland <johan@herland.net>
Thanks, both. Will apply.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-11-13 1:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-11 9:49 [PATCH] builtin/notes: remove unnecessary free Carlo Marcelo Arenas Belón
2018-11-11 10:41 ` Johan Herland
2018-11-13 1:29 ` Junio C Hamano
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).