texinfo/Avoid-memory-leak-for-malformed-files.patch
2019-09-30 11:18:22 -04:00

30 lines
869 B
Diff

From 6c0ec277c393a7fe7149a1dadc1ae20540884cbf Mon Sep 17 00:00:00 2001
From: Gavin Smith <gavinsmith0123@gmail.com>
Date: Fri, 28 Dec 2018 12:08:56 +0000
Subject: [PATCH 504/759] Avoid memory leak for malformed files.
* info/nodes.c (info_load_file): Free 'contents' and 'encoding'
fields of file structure in case the node table couldn't be
built.
---
ChangeLog | 8 ++++++++
info/nodes.c | 2 ++
2 files changed, 10 insertions(+)
diff --git a/info/nodes.c b/info/nodes.c
index 8b0f7c45e..860383436 100644
--- a/info/nodes.c
+++ b/info/nodes.c
@@ -735,6 +735,8 @@ info_load_file (char *fullpath, int is_subfile)
{
free (file_buffer->fullpath);
free (file_buffer->filename);
+ free (file_buffer->contents);
+ free (file_buffer->encoding);
free (file_buffer);
return 0;
}
--
2.19.1