commit b737c85ae178a737ce5b50fc1967390d2c54292b from: Stefan Sperling date: Fri Jun 26 10:10:52 2020 UTC fix endless loop introduced in 3143d852; programming is hard! commit - 21c17f12d490c7f4b55a696178331c5b490a18d4 commit + b737c85ae178a737ce5b50fc1967390d2c54292b blob - 82a6b4b7b9e073c4d26c6e63e14032229c1784e1 blob + fa614f520887702d967b996de71bba37b7462623 --- lib/worktree.c +++ lib/worktree.c @@ -2748,7 +2748,7 @@ add_ignores_from_parent_paths(struct got_pathlist_head const char *root_path, const char *path) { const struct got_error *err; - char *parent_path, *next_parent_path; + char *parent_path, *next_parent_path = NULL; err = add_ignores(ignores, root_path, "", -1, ".cvsignore"); @@ -2777,13 +2777,17 @@ add_ignores_from_parent_paths(struct got_pathlist_head break; err = got_path_dirname(&next_parent_path, parent_path); if (err) { - if (err->code != GOT_ERR_BAD_PATH) - return err; - err = NULL; /* traversed everything */ + if (err->code == GOT_ERR_BAD_PATH) + err = NULL; /* traversed everything */ break; } + free(parent_path); + parent_path = next_parent_path; + next_parent_path = NULL; } + free(parent_path); + free(next_parent_path); return err; }