# [PATCH] diff-delta: use realloc instead of xrealloc

4 messages from 2007-05-29 to 2007-05-30. Participants: Martin Koegler, Junio C Hamano, Nicolas Pitre.
Thread: https://gitlist.dev/t/8351

## Martin Koegler, 2007-05-29 19:08

Subject: [PATCH] diff-delta: use realloc instead of xrealloc
Message-ID: <1180465715346-git-send-email-mkoegler@auto.tuwien.ac.at>
URL: https://gitlist.dev/e/1180465715346-git-send-email-mkoegler%40auto.tuwien.ac.at

```
Commit 83572c1a914d3f7a8dd66d954c11bbc665b7b923 changed many
realloc to xrealloc. This change was made in diff-delta.c too,
although the code can handle an out of memory failure.

This patch reverts this change in diff-delta.c.

Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
---
 diff-delta.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/diff-delta.c b/diff-delta.c
index 17757d2..faf96e4 100644
--- a/diff-delta.c
+++ b/diff-delta.c
@@ -388,7 +388,7 @@ create_delta(const struct delta_index *index,
 				outsize = max_size + MAX_OP_SIZE + 1;
 			if (max_size && outpos > max_size)
 				break;
-			out = xrealloc(out, outsize);
+			out = realloc(out, outsize);
 			if (!out) {
 				free(tmp);
 				return NULL;
-- 
1.5.2.846.g9a144

```

## Junio C Hamano, 2007-05-29 23:51

Subject: Re: [PATCH] diff-delta: use realloc instead of xrealloc
Message-ID: <7v1wgz5gus.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7v1wgz5gus.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <1180465715346-git-send-email-mkoegler@auto.tuwien.ac.at>

```
Martin Koegler <mkoegler@auto.tuwien.ac.at> writes:

> Commit 83572c1a914d3f7a8dd66d954c11bbc665b7b923 changed many
> realloc to xrealloc. This change was made in diff-delta.c too,
> although the code can handle an out of memory failure.
>
> This patch reverts this change in diff-delta.c.

Wasn't there a discussion around this exact issue when the
original patch was applied?

```

## Nicolas Pitre, 2007-05-30 02:57

Subject: Re: [PATCH] diff-delta: use realloc instead of xrealloc
Message-ID: <alpine.LFD.0.99.0705292252220.11491@xanadu.home>
URL: https://gitlist.dev/e/alpine.LFD.0.99.0705292252220.11491%40xanadu.home
In-Reply-To: <7v1wgz5gus.fsf@assigned-by-dhcp.cox.net>

```
On Tue, 29 May 2007, Junio C Hamano wrote:

> Martin Koegler <mkoegler@auto.tuwien.ac.at> writes:
> 
> > Commit 83572c1a914d3f7a8dd66d954c11bbc665b7b923 changed many
> > realloc to xrealloc. This change was made in diff-delta.c too,
> > although the code can handle an out of memory failure.
> >
> > This patch reverts this change in diff-delta.c.
> 
> Wasn't there a discussion around this exact issue when the
> original patch was applied?

Maybe, but I cannot remember it, not can I justify that xrealloc now.


Nicolas

```

## Junio C Hamano, 2007-05-30 06:17

Subject: Re: [PATCH] diff-delta: use realloc instead of xrealloc
Message-ID: <7vhcpu4yzm.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vhcpu4yzm.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <alpine.LFD.0.99.0705292252220.11491@xanadu.home>

```
Nicolas Pitre <nico@cam.org> writes:

> On Tue, 29 May 2007, Junio C Hamano wrote:
>
>> Wasn't there a discussion around this exact issue when the
>> original patch was applied?
>
> Maybe, but I cannot remember it, not can I justify that xrealloc now.

Actually, the discussion was older than the patch.

    http://thread.gmane.org/gmane.comp.version-control.git/43766/focus=43783

And I myself suggested to use non x- variant of allocation
routines in diff-delta.c as the callers know how to handle near
oom condition ;-).

```
