Skip to content

Commit

Permalink
builtin/ls-remote.c: rearrange xcalloc arguments
Browse files Browse the repository at this point in the history
xcalloc() takes two arguments: the number of elements and their size.
cmd_ls_remote() passes the arguments in reverse order, passing the
size of a char*, followed by the number of char* to be allocated.

Rearrange them so they are in the correct order.

Signed-off-by: Brian Gesiak <modocache@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Brian Gesiak authored and Junio C Hamano committed May 27, 2014
1 parent 4a28f16 commit edd2d84
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion builtin/ls-remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)

if (argv[i]) {
int j;
pattern = xcalloc(sizeof(const char *), argc - i + 1);
pattern = xcalloc(argc - i + 1, sizeof(const char *));
for (j = i; j < argc; j++) {
int len = strlen(argv[j]);
char *p = xmalloc(len + 3);
Expand Down

0 comments on commit edd2d84

Please sign in to comment.