!12 fix memory leak
From: @binlingyu Reviewed-by: @robertxw Signed-off-by: @robertxw
This commit is contained in:
commit
25eee74cd8
38
5000-fix-memory-leak.patch
Normal file
38
5000-fix-memory-leak.patch
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
From ddacb22dac891332c759293ab6297090216b121b Mon Sep 17 00:00:00 2001
|
||||||
|
From: binlingyu <binlingyu@uniontech.com>
|
||||||
|
Date: Mon, 20 May 2024 16:24:12 +0800
|
||||||
|
Subject: [PATCH] fix-memory-leak
|
||||||
|
|
||||||
|
---
|
||||||
|
hostname.c | 9 +++++++--
|
||||||
|
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/hostname.c b/hostname.c
|
||||||
|
index 5be268e..63200be 100644
|
||||||
|
--- a/hostname.c
|
||||||
|
+++ b/hostname.c
|
||||||
|
@@ -262,15 +262,20 @@ show_name(enum type_t type)
|
||||||
|
switch(type)
|
||||||
|
{
|
||||||
|
case DEFAULT:
|
||||||
|
- printf("%s\n", localhost());
|
||||||
|
+ p=localhost();
|
||||||
|
+ printf("%s\n", p);
|
||||||
|
+ free(p);
|
||||||
|
break;
|
||||||
|
case SHORT:
|
||||||
|
p = localhost();
|
||||||
|
*(strchrnul(p, '.')) = '\0';
|
||||||
|
printf("%s\n", p);
|
||||||
|
+ free(p);
|
||||||
|
break;
|
||||||
|
case NIS:
|
||||||
|
- printf("%s\n", localdomain());
|
||||||
|
+ p=localdomain();
|
||||||
|
+ printf("%s\n", p);
|
||||||
|
+ free(p);
|
||||||
|
break;
|
||||||
|
case NIS_DEF:
|
||||||
|
printf("%s\n", localnisdomain());
|
||||||
|
--
|
||||||
|
2.20.1
|
||||||
@ -1,7 +1,7 @@
|
|||||||
Summary: Utility to set/show the host name or domain name
|
Summary: Utility to set/show the host name or domain name
|
||||||
Name: hostname
|
Name: hostname
|
||||||
Version: 3.23
|
Version: 3.23
|
||||||
Release: 1
|
Release: 2
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
URL: http://packages.qa.debian.org/h/hostname.html
|
URL: http://packages.qa.debian.org/h/hostname.html
|
||||||
Source0: http://ftp.de.debian.org/debian/pool/main/h/hostname/hostname_%{version}.tar.gz
|
Source0: http://ftp.de.debian.org/debian/pool/main/h/hostname/hostname_%{version}.tar.gz
|
||||||
@ -9,6 +9,7 @@ Source1: https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
|
|||||||
Source2: nis-domainname
|
Source2: nis-domainname
|
||||||
Source3: nis-domainname.service
|
Source3: nis-domainname.service
|
||||||
Patch1: hostname-rh.patch
|
Patch1: hostname-rh.patch
|
||||||
|
Patch2: 5000-fix-memory-leak.patch
|
||||||
|
|
||||||
BuildRequires: gcc
|
BuildRequires: gcc
|
||||||
|
|
||||||
@ -50,6 +51,12 @@ fi
|
|||||||
%{_libexecdir}/%{name}/*
|
%{_libexecdir}/%{name}/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue May 28 2024 binlingyu <binlingyu@uniontech.com> - 3.23-2
|
||||||
|
- Type:requirement
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:Fix memory leak.
|
||||||
|
|
||||||
* Sat Oct 29 2022 zhouyihang <zhouyihang3@h-partners.com> - 3.23-1
|
* Sat Oct 29 2022 zhouyihang <zhouyihang3@h-partners.com> - 3.23-1
|
||||||
- Type:requirement
|
- Type:requirement
|
||||||
- ID:NA
|
- ID:NA
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user