Commit 14ae1db50e77b79d408122595a67280b1c0f1e13

Stefan Sperling 2019-04-06T05:21:11

plug memory leaks in diff_fileindex_dir()

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/lib/fileindex.c b/lib/fileindex.c
index 544113f..b24976a 100644
--- a/lib/fileindex.c
+++ b/lib/fileindex.c
@@ -845,10 +845,13 @@ diff_fileindex_dir(struct got_fileindex *fileindex,
 		}
 
 		err = got_pathlist_insert(&new, &dirlist, de->d_name, de);
-		if (err)
+		if (err) {
+			free(de);
 			goto done;
+		}
 		if (new == NULL) {
 			err = got_error(GOT_ERR_DIR_DUP_ENTRY);
+			free(de);
 			goto done;
 		}
 	}