Prevent a leak of iconv_t

Resolves: RHEL-44911
This commit is contained in:
Pavel Cahyna 2024-08-21 13:48:23 +02:00
parent 1967eb8c89
commit 94f8f529d5
2 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,19 @@
diff -ur mtools-4.0.44/charsetConv.c mtools-4.0.44-memleaks/charsetConv.c
--- mtools-4.0.44/charsetConv.c 2022-09-24 10:43:03.000000000 +0200
+++ mtools-4.0.44-memleaks/charsetConv.c 2024-08-20 18:05:05.252088712 +0200
@@ -70,6 +70,7 @@
res = iconv(test,
&inbuf, &inbufLen,
&outbufP, &outbufLen);
+ iconv_close(test);
if(res != 0 || outbufLen != 0 || inbufLen != 0)
goto fail;
if(memcmp(outbuf, "ab", 2))
@@ -77,7 +78,6 @@
/* fprintf(stderr, "%s ok\n", testCp); */
return 1;
fail:
- iconv_close(test);
fail0:
/*fprintf(stderr, "%s fail\n", testCp);*/
return 0;

View File

@ -7,6 +7,7 @@ Source0: ftp://ftp.gnu.org/gnu/mtools/mtools-%{version}.tar.gz
Url: https://www.gnu.org/software/mtools/
Patch0: mtools-3.9.6-config.patch
Patch1: mtools-4.0.43-errmsgsize.patch
Patch2: mtools-4.0.43-iconv_close.patch
BuildRequires: make
BuildRequires: gcc
@ -33,6 +34,7 @@ Mtools should be installed if you need to use MS-DOS disks
%setup -q -n %{name}-%{version}
%patch 0 -p1 -b .conf
%patch 1 -p1
%patch 2 -p1
%build
autoreconf -fiv