Commit Diff


commit - fcbb06bf6925b542428b937afc9f37446058e748
commit + e643a76a2e696177d9ba6c2dcf6c13bfaa717570
blob - a4382294495a647321fccc2881af4c226294b2a5
blob + c25e6cbfab838e0e2a592a5135b11fdd960fab93
--- got/got.c
+++ got/got.c
@@ -5249,8 +5249,10 @@ cmd_diff(int argc, char *argv[])
 
 			if (asprintf(&header, "diffstat %s%s",
 			    diff_staged ? "-s " : "",
-			    got_worktree_get_root_path(worktree)) == -1)
+			    got_worktree_get_root_path(worktree)) == -1) {
+				error = got_error_from_errno("asprintf");
 				goto done;
+			}
 
 			error = print_diffstat(&dsa, &diffstat_paths, header);
 			free(header);
@@ -5421,8 +5423,10 @@ cmd_diff(int argc, char *argv[])
 		char *header = NULL;
 
 		if (asprintf(&header, "diffstat %s %s",
-		    labels[0], labels[1]) == -1)
+		    labels[0], labels[1]) == -1) {
+			error = got_error_from_errno("asprintf");
 			goto done;
+		}
 
 		error = print_diffstat(&dsa, &diffstat_paths, header);
 		free(header);