receive-pack: don't copy "dir" parameter
We used to do this so could pass a mutable string to enter_repo. But since 1c64b48 (enter_repo: do not modify input, 2011-10-04), this is not necessary. The resulting code is simpler, and it fixes a minor leak. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Jul 24, 2014 at 00:40 UTC
d51428bf17e9f17071836350299e256cac2d503a
1 file changed
+2
-2
builtin/receive-pack.c
+2
-2
@@ -1125,7 +1125,7 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
1125
int advertise_refs = 0;
1126
int stateless_rpc = 0;
1127
int i;
1128
- char *dir = NULL;
1128
+ const char *dir = NULL;
1129
struct command *commands;
1130
struct sha1_array shallow = SHA1_ARRAY_INIT;
1131
struct sha1_array ref = SHA1_ARRAY_INIT;
@@ -1160,7 +1160,7 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
1160
}
1161
if (dir)
1162
usage(receive_pack_usage);
1163
- dir = xstrdup(arg);
1163
+ dir = arg;
1164
}
1165
if (!dir)
1166
usage(receive_pack_usage);