Commit Diff


commit - 07a7f8ade254a4d5ce8af30faf37748391c19da0
commit + 5de261fe1da72d717a12aadc5ef8dc89b06c4556
blob - 7e70195ecd3a25097bdeea05d233ea42746d78f1
blob + dd50f8982f38aef266c0c423575786972565f157
--- regress/worktree/worktree_test.c
+++ regress/worktree/worktree_test.c
@@ -104,13 +104,15 @@ check_meta_file_exists(const char *worktree_path, cons
 {
 	struct stat sb;
 	char *path;
+	int ret = 0;
 
 	if (asprintf(&path, "%s/%s/%s", worktree_path, GOT_WORKTREE_GOT_DIR,
 	    name) == -1)
 		return 0;
-	if (stat(path, &sb) == -1)
-		return 0;
-	return 1;
+	if (stat(path, &sb) == 0)
+		ret = 1;
+	free(path);
+	return ret;
 }
 
 static int