diff options
| author | Junio C Hamano <junkio@cox.net> | 2006-05-06 21:47:07 -0700 |
|---|---|---|
| committer | Junio C Hamano <junkio@cox.net> | 2006-05-06 21:47:07 -0700 |
| commit | e04156a437e671a772187da789d6a736a8125eef (patch) | |
| tree | 3e335fbf5dc5a7f0439e85f8fa60503b10d8a303 | |
| parent | aadc81c13bbb103e7db759ba9a98a6f9509831f1 (diff) | |
| parent | 0cc9e70c4c9adb3e79b4a492f2f989c611d85966 (diff) | |
| download | git-e04156a437e671a772187da789d6a736a8125eef.tar.xz | |
Merge branch 'jc/reupdate' into next
* jc/reupdate:
Fix users of prefix_path() to free() only when necessary
| -rw-r--r-- | checkout-index.c | 4 | ||||
| -rw-r--r-- | update-index.c | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/checkout-index.c b/checkout-index.c index 64bdc3bd13..9876af6fd6 100644 --- a/checkout-index.c +++ b/checkout-index.c @@ -278,7 +278,7 @@ int main(int argc, char **argv) die("git-checkout-index: don't mix '--stdin' and explicit filenames"); p = prefix_path(prefix, prefix_length, arg); checkout_file(p); - if (p != arg) + if (p < arg || p > arg + strlen(arg)) free((char*)p); } @@ -300,7 +300,7 @@ int main(int argc, char **argv) path_name = buf.buf; p = prefix_path(prefix, prefix_length, path_name); checkout_file(p); - if (p != path_name) + if (p < path_name || p > path_name + strlen(path_name)) free((char *)p); if (path_name != buf.buf) free(path_name); diff --git a/update-index.c b/update-index.c index 7db67aacfe..f6b09a4800 100644 --- a/update-index.c +++ b/update-index.c @@ -393,7 +393,7 @@ static void update_one(const char *path, const char *prefix, int prefix_length) die("Unable to process file %s", path); report("add '%s'", path); free_return: - if (p != path) + if (p < path || p > path + strlen(path)) free((char*)p); } @@ -609,7 +609,7 @@ static int do_unresolve(int ac, const char **av, const char *arg = av[i]; const char *p = prefix_path(prefix, prefix_length, arg); err |= unresolve_one(p); - if (p != arg) + if (p < arg || p > arg + strlen(arg)) free((char*)p); } return err; @@ -623,7 +623,7 @@ static int do_reupdate(int ac, const char **av, */ int pos; int has_head = 1; - char **pathspec = get_pathspec(prefix, av + 1); + const char **pathspec = get_pathspec(prefix, av + 1); if (read_ref(git_path("HEAD"), head_sha1)) /* If there is no HEAD, that means it is an initial @@ -815,7 +815,7 @@ int main(int argc, const char **argv) update_one(p, NULL, 0); if (set_executable_bit) chmod_path(set_executable_bit, p); - if (p != path_name) + if (p < path_name || p > path_name + strlen(path_name)) free((char*) p); if (path_name != buf.buf) free(path_name); |
