"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Mark Jamsek <mark@jamsek.com>
Subject:
plug leak in tog log error path
To:
gameoftrees@openbsd.org
Date:
Sun, 23 Jul 2023 20:30:33 +1000

Download raw body.

Thread
As per the subject, we leak repo_path and pack_fds on getcwd() error
in cmd_log():


-----------------------------------------------
commit c0a534a70435cd78bf8009827f0cb023fa7f2e09 (main)
from: Mark Jamsek <mark@jamsek.dev>
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;



-- 
Mark Jamsek <https://bsdbox.org>
GPG: F2FF 13DE 6A06 C471 CA80  E6E2 2930 DC66 86EE CF68