summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
Diffstat (limited to 'builtin')
-rw-r--r--builtin/apply.c2
-rw-r--r--builtin/receive-pack.c4
-rw-r--r--builtin/rev-parse.c1
-rw-r--r--builtin/show-branch.c1
4 files changed, 5 insertions, 3 deletions
diff --git a/builtin/apply.c b/builtin/apply.c
index 9f8f5bac07..be2b4ce2fd 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -1075,7 +1075,7 @@ static int gitdiff_index(const char *line, struct patch *patch)
line = ptr + 2;
ptr = strchr(line, ' ');
- eol = strchr(line, '\n');
+ eol = strchrnul(line, '\n');
if (!ptr || eol < ptr)
ptr = eol;
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index 92561bffc1..f93ac454b4 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -1122,7 +1122,7 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
int advertise_refs = 0;
int stateless_rpc = 0;
int i;
- char *dir = NULL;
+ const char *dir = NULL;
struct command *commands;
struct sha1_array shallow = SHA1_ARRAY_INIT;
struct sha1_array ref = SHA1_ARRAY_INIT;
@@ -1157,7 +1157,7 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
}
if (dir)
usage(receive_pack_usage);
- dir = xstrdup(arg);
+ dir = arg;
}
if (!dir)
usage(receive_pack_usage);
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index 8102aaa924..d85e08cc9c 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c
@@ -151,6 +151,7 @@ static void show_rev(int type, const unsigned char *sha1, const char *name)
error("refname '%s' is ambiguous", name);
break;
}
+ free(full);
} else {
show_with_type(type, name);
}
diff --git a/builtin/show-branch.c b/builtin/show-branch.c
index 5fd4e4e488..298c95e3f8 100644
--- a/builtin/show-branch.c
+++ b/builtin/show-branch.c
@@ -777,6 +777,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
sprintf(nth_desc, "%s@{%d}", *av, base+i);
append_ref(nth_desc, sha1, 1);
}
+ free(ref);
}
else if (all_heads + all_remotes)
snarf_refs(all_heads, all_remotes);