!16 [sync] PR-15: 修复sanlock内存泄露问题

From: @openeuler-sync-bot 
Reviewed-by: @zhuchunyi 
Signed-off-by: @zhuchunyi
This commit is contained in:
openeuler-ci-bot 2022-11-08 11:39:55 +00:00 committed by Gitee
commit 9b4858540a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 36 additions and 1 deletions

View File

@ -0,0 +1,30 @@
From 1fa8d43007b31115342002ac675c905d9f18fbd9 Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Thu, 3 Mar 2022 09:39:52 -0600
Subject: [PATCH] sanlock: fix memory leak of lockspace renewal_history
Leak was in original commit for "sanlock: renewal history"
6313c709722b3ba63234a75d1651a160bf1728ee.
With the default renewal history size, each lockspace that
was created would leak about 4kb of memory.
---
src/lockspace.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/lockspace.c b/src/lockspace.c
index 2ebc247..d23dccd 100644
--- a/src/lockspace.c
+++ b/src/lockspace.c
@@ -939,6 +939,8 @@ static void free_sp(struct space *sp)
{
if (sp->lease_status.renewal_read_buf)
free(sp->lease_status.renewal_read_buf);
+ if (sp->renewal_history)
+ free(sp->renewal_history);
free(sp);
}
--
1.8.3.1

View File

@ -1,11 +1,13 @@
Name: sanlock
Version: 3.8.4
Release: 1
Release: 2
Summary: A shared storage lock manager
License: GPLv2 and GPLv2+ and LGPLv2+
URL: https://pagure.io/sanlock/
Source0: https://releases.pagure.org/sanlock/%{name}-%{version}.tar.gz
Patch1: 0001-sanlock-fix-memory-leak-of-lockspace-renewal_history.patch
BuildRequires: libblkid-devel libaio-devel python3 python3-devel systemd-units gcc
Requires(pre): shadow
Requires(post): systemd-units systemd-sysv
@ -150,6 +152,9 @@ getent passwd sanlock > /dev/null || /usr/sbin/useradd \
%changelog
* Wed Oct 19 2022 lihaoxiang <lihaoxiang9@huawei.com> - 3.8.4-2
- sanlock:fix memory leak of lockspace renewal history
* Tue Nov 23 2021 yanglongkang <yanglongkang@huawei.com> - 3.8.4-1
- update to 3.8.4