[PATCH 1/1] ui-log: fix data corruption

Christian Hesse list at eworm.de
Fri Oct 7 15:35:26 CEST 2016


From: Christian Hesse <mail at eworm.de>

This data is allocated in a bigger context. So we should not free it
here to prevent data corruption.

Signed-off-by: Christian Hesse <mail at eworm.de>
---
 ui-log.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/ui-log.c b/ui-log.c
index a31ff7c..cba91af 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -484,9 +484,6 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
 	for (i = 0; i < ofs && (commit = get_revision(&rev)) != NULL; /* nop */) {
 		if (show_commit(commit, &rev))
 			i++;
-		free_commit_buffer(commit);
-		free_commit_list(commit->parents);
-		commit->parents = NULL;
 	}
 
 	for (i = 0; i < cnt && (commit = get_revision(&rev)) != NULL; /* nop */) {
@@ -506,9 +503,6 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
 			i++;
 			print_commit(commit, &rev);
 		}
-		free_commit_buffer(commit);
-		free_commit_list(commit->parents);
-		commit->parents = NULL;
 	}
 	if (pager) {
 		html("</table><ul class='pager'>");
-- 
2.10.0



More information about the CGit mailing list