commit 8fb6814c7fc92dbee5d95b1c66383d00bfa60f49 from: Omar Polo date: Fri Aug 05 17:52:27 2022 UTC avoid allocating too many errors in cmd_info got_error_path uses get_custom_err to get a statically allocated error allocated on a buffer that's used a ring. This is nice and simple, but the drawback is that thees custom errors shouldn't be used "for too long" because they might get overwritten later. cmd_info is one offender: change it to store a "simple" error and later re-use it to construct the per-path error. OK and tweaks stsp@ commit - 575dd20f850659c3caa159936f3fa7e88867b8a7 commit + 8fb6814c7fc92dbee5d95b1c66383d00bfa60f49 blob - 77ab232b3e3dd99d8500f2e4792976396ecafda9 blob + 39827e91edca9da87bdc0ce98c9a77260b22dd4e --- got/got.c +++ got/got.c @@ -13095,8 +13095,7 @@ cmd_info(int argc, char *argv[]) * Assume this path will fail. This will be corrected * in print_path_info() in case the path does suceeed. */ - pe->data = (void *)got_error_path(pe->path, - GOT_ERR_BAD_PATH); + pe->data = (void *)got_error(GOT_ERR_BAD_PATH); } error = got_worktree_path_info(worktree, &paths, print_path_info, &paths, check_cancelled, NULL); @@ -13104,7 +13103,11 @@ cmd_info(int argc, char *argv[]) goto done; TAILQ_FOREACH(pe, &paths, entry) { if (pe->data != NULL) { - error = pe->data; /* bad path */ + const struct got_error *perr; + + perr = pe->data; + error = got_error_fmt(perr->code, "%s", + pe->path); break; } }