Git development
 help / color / mirror / Atom feed
* [PATCH 1/2] Added use of xmalloc() on diff-delta.c
@ 2007-04-04 18:50 Bruno Ribas
  2007-04-04 18:50 ` [PATCH 2/2] Removed NULL check on builtin-pack-objects.c from create_delta_index() as it just checks for Out of Memory Bruno Ribas
  2007-04-04 19:22 ` [PATCH 1/2] Added use of xmalloc() on diff-delta.c Junio C Hamano
  0 siblings, 2 replies; 5+ messages in thread
From: Bruno Ribas @ 2007-04-04 18:50 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Bruno Ribas


Signed-off-by: Bruno Ribas <ribas@c3sl.ufpr.br>
---
 diff-delta.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/diff-delta.c b/diff-delta.c
index 9f998d0..74a8377 100644
--- a/diff-delta.c
+++ b/diff-delta.c
@@ -157,9 +157,8 @@ struct delta_index * create_delta_index(const void *buf, unsigned long bufsize)
 	memsize = sizeof(*index) +
 		  sizeof(*hash) * hsize +
 		  sizeof(*entry) * entries;
-	mem = malloc(memsize);
-	if (!mem)
-		return NULL;
+	mem = xmalloc(memsize);
+
 	index = mem;
 	mem = index + 1;
 	hash = mem;
@@ -258,9 +257,7 @@ create_delta(const struct delta_index *index,
 	outsize = 8192;
 	if (max_size && outsize >= max_size)
 		outsize = max_size + MAX_OP_SIZE + 1;
-	out = malloc(outsize);
-	if (!out)
-		return NULL;
+	out = xmalloc(outsize);
 
 	/* store reference buffer size */
 	i = index->src_size;
-- 
1.5.0.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-04-05  5:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-04 18:50 [PATCH 1/2] Added use of xmalloc() on diff-delta.c Bruno Ribas
2007-04-04 18:50 ` [PATCH 2/2] Removed NULL check on builtin-pack-objects.c from create_delta_index() as it just checks for Out of Memory Bruno Ribas
2007-04-04 19:22 ` [PATCH 1/2] Added use of xmalloc() on diff-delta.c Junio C Hamano
2007-04-04 22:31   ` Linus Torvalds
2007-04-05  5:14     ` 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