Fix botched "leak fix"
When (new_name == old_name), the previous one prefixed old_name alone, leaving new_name untouched, and worse yet, left it dangling pointing at an already freed memory location. Signed-off-by: Junio C Hamano <junkio@cox.net>maint
parent
c24e9757e9
commit
6c912f5b04
|
@ -2516,10 +2516,16 @@ static void prefix_patches(struct patch *p)
|
|||
if (!prefix)
|
||||
return;
|
||||
for ( ; p; p = p->next) {
|
||||
if (p->new_name != p->old_name)
|
||||
if (p->new_name == p->old_name) {
|
||||
char *prefixed = p->new_name;
|
||||
prefix_one(&prefixed);
|
||||
p->new_name = p->old_name = prefixed;
|
||||
}
|
||||
else {
|
||||
prefix_one(&p->new_name);
|
||||
prefix_one(&p->old_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int apply_patch(int fd, const char *filename, int inaccurate_eof)
|
||||
|
|
Loading…
Reference in New Issue