commit 718ef3e9e896770be288214c9e03de887cb683cd from: Stefan Sperling date: Sun Aug 11 18:15:17 2019 UTC simplify cleanup code paths in got_path_find_prog() commit - 202329ae1b4393a9093c61915de94a5a9a51555a commit + 718ef3e9e896770be288214c9e03de887cb683cd blob - 8ae1c968c45c54f7fc96908130daa2dd453393d3 blob + be1796398c02584ccc6c44a496c5dea108e7d3bf --- lib/path.c +++ lib/path.c @@ -438,14 +438,11 @@ got_path_find_prog(char **filename, const char *prog) if (asprintf(filename, "%s/%s", p, prog) == -1) { err = got_error_from_errno("asprintf"); - free(path); - return err; + break; } if ((stat(*filename, &sbuf) == 0) && S_ISREG(sbuf.st_mode) && - access(*filename, X_OK) == 0) { - free(path); - return NULL; - } + access(*filename, X_OK) == 0) + break; free(*filename); *filename = NULL; continue;