Commit 39a1a66242a480b880032f5a6a4e31ee77414d4c

Russell Belfer 2013-07-24T13:09:07

Don't unload diff data unless loaded

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/src/diff_file.c b/src/diff_file.c
index 9d06daa..19bcf2d 100644
--- a/src/diff_file.c
+++ b/src/diff_file.c
@@ -417,6 +417,9 @@ int git_diff_file_content__load(git_diff_file_content *fc)
 
 void git_diff_file_content__unload(git_diff_file_content *fc)
 {
+	if ((fc->flags & GIT_DIFF_FLAG__LOADED) == 0)
+		return;
+
 	if (fc->flags & GIT_DIFF_FLAG__FREE_DATA) {
 		git__free(fc->map.data);
 		fc->map.data = "";