Commit Diff


commit - d3f84d51c4443f621486b49558aa86b4e5c45a04
commit + a297e751ef5b62d166e2d25b2a237ba0c6119cfb
blob - b141b0331a9ba966ddf63bb4ed602a7e9504f412
blob + 881055b911cb55414294ca77ad1a371f8bc58946
--- got/got.c
+++ got/got.c
@@ -774,6 +774,10 @@ cmd_update(int argc, char *argv[])
 		error = got_repo_match_object_id_prefix(&commit_id,
 		    commit_id_str, GOT_OBJ_TYPE_COMMIT, repo);
 		if (error != NULL)
+			goto done;
+		free(commit_id_str);
+		error = got_object_id_str(&commit_id_str, commit_id);
+		if (error)
 			goto done;
 	}
 
@@ -1478,7 +1482,7 @@ cmd_diff(int argc, char *argv[])
 		if (error != NULL)
 			goto done;
 	} else {
-		label1 = strdup(id_str1);
+		error = got_object_id_str(&label1, id1);
 		if (label1 == NULL) {
 			error = got_error_from_errno("strdup");
 			goto done;
@@ -1504,7 +1508,7 @@ cmd_diff(int argc, char *argv[])
 		if (error != NULL)
 			goto done;
 	} else {
-		label2 = strdup(id_str2);
+		error = got_object_id_str(&label2, id2);
 		if (label2 == NULL) {
 			error = got_error_from_errno("strdup");
 			goto done;