diff --git a/builtin/push.c b/builtin/push.c
index 69bc2f27ac414ce3532f6babcc68671b0b95d65a..e655eb7695faba13c4d9e8f25b9649ffec7195be 100644 (file)
--- a/builtin/push.c
+++ b/builtin/push.c
static const char **refspec;
static int refspec_nr;
+static int refspec_alloc;
static void add_refspec(const char *ref)
{
- int nr = refspec_nr + 1;
- refspec = xrealloc(refspec, nr * sizeof(char *));
- refspec[nr-1] = ref;
- refspec_nr = nr;
+ refspec_nr++;
+ ALLOC_GROW(refspec, refspec_nr, refspec_alloc);
+ refspec[refspec_nr-1] = ref;
}
static void set_refspecs(const char **refs, int nr)