Commit Diff


commit - 00b3e9ae14f04a45f1ca7445bade6b41a6e8a1c5
commit + a7331d50e5949de9db777b05789d7180d1082fd4
blob - 850056f73d0f8671f6fc63162e2753e92b8b8c41
blob + a20fdf567d2fb43a228a54708fee12c13f94796b
--- 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);