* [PATCH] fix memory leak in parse_object when check_sha1_signature fails
@ 2007-05-25 1:46 Carlos Rica
2007-05-25 2:09 ` Shawn O. Pearce
0 siblings, 1 reply; 3+ messages in thread
From: Carlos Rica @ 2007-05-25 1:46 UTC (permalink / raw)
To: git, Junio C Hamano
When check_sha1_signature fails, program is not terminated:
it prints an error message and returns NULL, so the
buffer returned by read_sha1_file should be freed before.
Signed-off-by: Carlos Rica <jasampler@gmail.com>
---
object.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/object.c b/object.c
index 78a44a6..ccd7dd7 100644
--- a/object.c
+++ b/object.c
@@ -185,6 +185,7 @@ struct object *parse_object(const unsigned char *sha1)
if (buffer) {
struct object *obj;
if (check_sha1_signature(sha1, buffer, size, typename(type)) < 0) {
+ free(buffer);
error("sha1 mismatch %s\n", sha1_to_hex(sha1));
return NULL;
}
--
1.5.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] fix memory leak in parse_object when check_sha1_signature fails
2007-05-25 1:46 [PATCH] fix memory leak in parse_object when check_sha1_signature fails Carlos Rica
@ 2007-05-25 2:09 ` Shawn O. Pearce
2007-05-25 2:38 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Shawn O. Pearce @ 2007-05-25 2:09 UTC (permalink / raw)
To: Carlos Rica; +Cc: git, Junio C Hamano
Carlos Rica <jasampler@gmail.com> wrote:
> When check_sha1_signature fails, program is not terminated:
> it prints an error message and returns NULL, so the
> buffer returned by read_sha1_file should be freed before.
...
> if (check_sha1_signature(sha1, buffer, size, typename(type))
> < 0) {
...
gmail strikes again. The above line is wrapped, which means your
patch is whitespace damaged and won't apply properly.
--
Shawn.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] fix memory leak in parse_object when check_sha1_signature fails
2007-05-25 2:09 ` Shawn O. Pearce
@ 2007-05-25 2:38 ` Junio C Hamano
0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2007-05-25 2:38 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: Carlos Rica, git
"Shawn O. Pearce" <spearce@spearce.org> writes:
> Carlos Rica <jasampler@gmail.com> wrote:
>> When check_sha1_signature fails, program is not terminated:
>> it prints an error message and returns NULL, so the
>> buffer returned by read_sha1_file should be freed before.
> ...
>> if (check_sha1_signature(sha1, buffer, size, typename(type))
>> < 0) {
> ...
>
> gmail strikes again. The above line is wrapped, which means your
> patch is whitespace damaged and won't apply properly.
That is only between your eyes, imagination and your MUA (hint:
"format: flowed").
For applying after saving it in mbox it does not pose a problem,
but it _does_ affect people who want to comment on the patch
while in MUA.
Is there a way to turn that "format: flawed" off?
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-05-25 2:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-25 1:46 [PATCH] fix memory leak in parse_object when check_sha1_signature fails Carlos Rica
2007-05-25 2:09 ` Shawn O. Pearce
2007-05-25 2:38 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox