From: Omar Polo Subject: Re: plug leak in tog log error path To: Mark Jamsek Cc: gameoftrees@openbsd.org Date: Sun, 23 Jul 2023 12:37:12 +0200 On 2023/07/23 20:30:33 +1000, Mark Jamsek wrote: > As per the subject, we leak repo_path and pack_fds on getcwd() error > in cmd_log(): ok > ----------------------------------------------- > commit c0a534a70435cd78bf8009827f0cb023fa7f2e09 (main) > from: Mark Jamsek > date: Sun Jul 23 10:19:35 2023 UTC > > tog: plug leak in cmd_log() error path > > diff 02af858a6ee42bbbf72128ab9643d850e32bce51 c0a534a70435cd78bf8009827f0cb023fa7f2e09 > commit - 02af858a6ee42bbbf72128ab9643d850e32bce51 > commit + c0a534a70435cd78bf8009827f0cb023fa7f2e09 > blob - 00b76714868599ae292351b665e7a84bbeb85b81 > blob + 7850a8a50fe8ff23c3f0d68ab713639f97d85090 > --- tog/tog.c > +++ tog/tog.c > @@ -4472,8 +4472,10 @@ cmd_log(int argc, char *argv[]) > > if (repo_path == NULL) { > cwd = getcwd(NULL, 0); > - if (cwd == NULL) > - return got_error_from_errno("getcwd"); > + if (cwd == NULL) { > + error = got_error_from_errno("getcwd"); > + goto done; > + } > error = got_worktree_open(&worktree, cwd, NULL); > if (error && error->code != GOT_ERR_NOT_WORKTREE) > goto done;