X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=builtin%2Fpush.c;h=e655eb7695faba13c4d9e8f25b9649ffec7195be;hb=385cc9d8c44eb5be9d57e630129752a72c0a08c8;hp=69bc2f27ac414ce3532f6babcc68671b0b95d65a;hpb=e917918335e660629007f3d2d07d3d9a019b5273;p=git.git diff --git a/builtin/push.c b/builtin/push.c index 69bc2f27a..e655eb769 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -22,13 +22,13 @@ static int progress; 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)