Commit Diff


commit - 85a6d91e579b8b438666dabb442ebfb944d1483e3b41bf0e3e89abaebf4a5662
commit + 9b1058aa2b755fd9b728b64d982f1eac5aabe3db94598eb72b9b9540c2e1b548
blob - 397cdb9c332df0563171ca4f9df5dc6a0ab15449f921472240f2e7012f385f8a
blob + 79261d890769cdde8b3783511c262241392262d8525ed9421b5aa813faa8c06f
--- lib/diff3.c	
+++ lib/diff3.c	
@@ -206,7 +206,7 @@ static const struct got_error*
 diffreg(BUF **d, const char *path1, const char *path2,
     enum got_diff_algorithm diff_algo)
 {
-	const struct got_error *err = NULL;
+	const struct got_error *err = NULL, *free_err;
 	FILE *f1 = NULL, *f2 = NULL, *outfile = NULL;
 	char *outpath = NULL;
 	struct got_diffreg_result *diffreg_result = NULL;
@@ -270,6 +270,9 @@ done:
 		err = got_error_from_errno("fclose");
 	if (f2 && fclose(f2) == EOF && err == NULL)
 		err = got_error_from_errno("fclose");
+	free_err = got_diffreg_result_free(diffreg_result);
+	if (free_err && err == NULL)
+		err = free_err;
 	return err;
 }