Fix small memory leaks induced by diff_tree_setup_paths
Run diff_tree_release_paths in the appropriate places, and add a test to avoid NULL dereference. Better safe than sorry. Signed-off-by: Mike Hommey <mh@glandium.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
b0fe0d7258
commit
03b69c7606
@ -388,6 +388,7 @@ static struct origin *find_origin(struct scoreboard *sb,
|
||||
}
|
||||
}
|
||||
diff_flush(&diff_opts);
|
||||
diff_tree_release_paths(&diff_opts);
|
||||
if (porigin) {
|
||||
/*
|
||||
* Create a freestanding copy that is not part of
|
||||
@ -444,6 +445,7 @@ static struct origin *find_rename(struct scoreboard *sb,
|
||||
}
|
||||
}
|
||||
diff_flush(&diff_opts);
|
||||
diff_tree_release_paths(&diff_opts);
|
||||
return porigin;
|
||||
}
|
||||
|
||||
@ -1165,7 +1167,7 @@ static int find_copy_in_parent(struct scoreboard *sb,
|
||||
}
|
||||
}
|
||||
diff_flush(&diff_opts);
|
||||
|
||||
diff_tree_release_paths(&diff_opts);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user