From: Jonas Fonseca <fonseca@diku.dk>
To: git@vger.kernel.org
Subject: [PATCH] parse_object: check if buffer is non-NULL before freeing it
Date: Mon, 28 Aug 2006 02:31:29 +0200 [thread overview]
Message-ID: <20060828003129.GE20904@diku.dk> (raw)
Two code paths may cause this and other places in the source have the
courtesy to do the check.
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
---
object.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/object.c b/object.c
index 9281300..c08347f 100644
--- a/object.c
+++ b/object.c
@@ -173,7 +173,8 @@ struct object *parse_object(const unsign
} else {
obj = NULL;
}
- free(buffer);
+ if (buffer)
+ free(buffer);
return obj;
}
return NULL;
--
1.4.2.g2f76-dirty
--
Jonas Fonseca
next reply other threads:[~2006-08-28 0:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-28 0:31 Jonas Fonseca [this message]
2006-08-28 4:20 ` [PATCH] parse_object: check if buffer is non-NULL before freeing it Junio C Hamano
2006-08-28 4:33 ` Linus Torvalds
2006-08-28 5:46 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060828003129.GE20904@diku.dk \
--to=fonseca@diku.dk \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.