Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
branch: fix segfault when resolving an invalid HEAD
author
Jonas Fonseca
<fonseca@diku.dk>
Sun, 20 May 2007 12:19:17 +0000
(14:19 +0200)
committer
Junio C Hamano
<junkio@cox.net>
Sun, 20 May 2007 21:39:16 +0000
(14:39 -0700)
Caused by return value of resolve_ref being passed directly
to xstrdup whereby the sanity checking was never reached.
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-branch.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
f7b47b2
)
diff --git
a/builtin-branch.c
b/builtin-branch.c
index 7408285050a0f41a33d31c73e79c2fdefe567593..8956d0f84213afbd0e53e39bc863c05960f524f0 100644
(file)
--- a/
builtin-branch.c
+++ b/
builtin-branch.c
@@
-623,9
+623,10
@@
int cmd_branch(int argc, const char **argv, const char *prefix)
(rename && force_create))
usage(builtin_branch_usage);
- head =
xstrdup(resolve_ref("HEAD", head_sha1, 0, NULL)
);
+ head =
resolve_ref("HEAD", head_sha1, 0, NULL
);
if (!head)
die("Failed to resolve HEAD as a valid ref.");
+ head = xstrdup(head);
if (!strcmp(head, "HEAD")) {
detached = 1;
}