avoid a leak when linter aborts after producing parsable output

Resolves: RHEL-36769
This commit is contained in:
Lukáš Zaoral 2024-12-11 10:32:29 +01:00
parent 9d32112620
commit 2cc7f924a3
No known key found for this signature in database
GPG Key ID: 39157506DD67752D
2 changed files with 42 additions and 1 deletions

View File

@ -0,0 +1,35 @@
From 7fd38e88c12133859f48ca3191fe341795401982 Mon Sep 17 00:00:00 2001
From: Lukáš Zaoral <lzaoral@redhat.com>
Date: Tue, 10 Dec 2024 10:01:07 +0100
Subject: memory: avoid a leak when linter aborts after producing parsable
output
Any collected messages should be freed also after an
abnormal exit of the linter.
Buglet existed since version 2.4.1, commit f225991b.
---
src/text.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/text.c b/src/text.c
index e924e818..5ac9d4ca 100644
--- a/src/text.c
+++ b/src/text.c
@@ -2755,6 +2755,13 @@ void do_linter(void)
if (!WIFEXITED(lint_status) || WEXITSTATUS(lint_status) > 2) {
statusline(ALERT, _("Error invoking '%s'"), openfile->syntax->linter);
+ for (curlint = lints; curlint != NULL;) {
+ tmplint = curlint;
+ curlint = curlint->next;
+ free(tmplint->msg);
+ free(tmplint->filename);
+ free(tmplint);
+ }
return;
}
--
cgit v1.2.3-70-g09d2

View File

@ -1,7 +1,7 @@
Summary: A small text editor
Name: nano
Version: 8.1
Release: 2%{?dist}
Release: 3%{?dist}
License: GPL-3.0-or-later
URL: https://www.nano-editor.org
@ -14,6 +14,9 @@ Source2: bensberg.pgp
# Additional sources
Source3: nanorc
# avoid a leak when linter aborts after producing parsable output (RHEL-36769)
Patch0: nano-8.1-fix-leak-after-linter-failure.patch
BuildRequires: file-devel
BuildRequires: gettext-devel
BuildRequires: gcc
@ -78,6 +81,9 @@ rm -rf %{buildroot}%{_datadir}/nano/extra
%{_datadir}/nano
%changelog
* Wed Dec 11 2024 Lukáš Zaoral <lzaoral@redhat.com> - 8.1-3
- avoid a leak when linter aborts after producing parsable output (RHEL-36769)
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 8.1-2
- Bump release for October 2024 mass rebuild:
Resolves: RHEL-64018