# [PATCH 1/4] Fix allocation of "int*" instead of "int".

3 messages from 2007-07-31 to 2007-08-01. Participants: Christian Couder, Jeff King.
Thread: https://gitlist.dev/t/9328

## Christian Couder, 2007-07-31 12:48

Subject: [PATCH 1/4] Fix allocation of "int*" instead of "int".
Message-ID: <20070731144829.ea83d43d.chriscool@tuxfamily.org>
URL: https://gitlist.dev/e/20070731144829.ea83d43d.chriscool%40tuxfamily.org

```
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---

 While working on something like a "git bisect dunno", I came up with
 the patches in this series.

 Thanks in advance,
 Christian.

 builtin-rev-list.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index 8efd609..5bcafe4 100644
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
@@ -300,7 +300,7 @@ static struct commit_list *find_bisection(struct commit_list *list,
 	show_list("bisection 2 sorted", 0, nr, list);
 
 	*all = nr;
-	weights = xcalloc(on_list, sizeof(int*));
+	weights = xcalloc(on_list, sizeof(int));
 	counted = 0;
 
 	for (n = 0, p = list; p; p = p->next) {
-- 
1.5.2.1.144.gabc40

```

## Jeff King, 2007-07-31 19:56

Subject: Re: [PATCH 1/4] Fix allocation of "int*" instead of "int".
Message-ID: <20070731195616.GA6329@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20070731195616.GA6329%40sigill.intra.peff.net
In-Reply-To: <20070731144829.ea83d43d.chriscool@tuxfamily.org>

```
On Tue, Jul 31, 2007 at 02:48:29PM +0200, Christian Couder wrote:

> -	weights = xcalloc(on_list, sizeof(int*));
> +	weights = xcalloc(on_list, sizeof(int));

How about the correct-by-definition sizeof(*weights)?

-Peff

```

## Christian Couder, 2007-08-01 04:11

Subject: Re: [PATCH 1/4] Fix allocation of "int*" instead of "int".
Message-ID: <200708010611.14171.chriscool@tuxfamily.org>
URL: https://gitlist.dev/e/200708010611.14171.chriscool%40tuxfamily.org
In-Reply-To: <20070731195616.GA6329@sigill.intra.peff.net>

```
Le mardi 31 juillet 2007 21:56, Jeff King a écrit :
> On Tue, Jul 31, 2007 at 02:48:29PM +0200, Christian Couder wrote:
> > -	weights = xcalloc(on_list, sizeof(int*));
> > +	weights = xcalloc(on_list, sizeof(int));
>
> How about the correct-by-definition sizeof(*weights)?

That's ok for me too.

Thanks,
Christian.

```
