Commit Diff


commit - f2cf8fbb2f991890d446eb5f7b566b2c8312333c
commit + 14ae1db50e77b79d408122595a67280b1c0f1e13
blob - 544113f9721705798aabdcf094882df9d3539d6a
blob + b24976ac486c6a231b6f8e5bdee5445d5eea878e
--- lib/fileindex.c
+++ 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;
 		}
 	}