From b8ee886a602dbd7c4b208dc33e872d93c5accf84 Mon Sep 17 00:00:00 2001 From: Miciah Dashiel Butler Masters Date: Fri, 3 Feb 2006 20:12:24 +0000 Subject: [PATCH] sort_links: fix memory leak Free document->lines1 and document->lines2 if they are already set. This fixes a memory leak from commit 52d3a6411dfbbde866ed3c973740a598ec07f125. --- src/document/renderer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/document/renderer.c b/src/document/renderer.c index e6ddec68f..0a164b445 100644 --- a/src/document/renderer.c +++ b/src/document/renderer.c @@ -512,7 +512,9 @@ sort_links(struct document *document) if (!document->height) return; + mem_free_if(document->lines1); document->lines1 = mem_calloc(document->height, sizeof(*document->lines1)); + mem_free_if(document->lines2); if (!document->lines1) return; document->lines2 = mem_calloc(document->height, sizeof(*document->lines2)); if (!document->lines2) {