newURL, fixed small memoryleak, check for malloc success (#473488)

This commit is contained in:
Ondrej Vasik 2008-12-01 13:44:43 +00:00
parent 1d489af5fc
commit 5f233f20b4
2 changed files with 43 additions and 2 deletions

View File

@ -0,0 +1,34 @@
diff -urNp ncompress-4.2.4-orig/compress42.c ncompress-4.2.4/compress42.c
--- ncompress-4.2.4-orig/compress42.c 2008-12-01 13:50:17.000000000 +0100
+++ ncompress-4.2.4/compress42.c 2008-12-01 13:53:03.000000000 +0100
@@ -132,6 +132,7 @@
*/
#include <unistd.h>
#include <stdio.h>
+#include <stdlib.h>
#include <fcntl.h>
#include <ctype.h>
#include <signal.h>
@@ -696,7 +697,13 @@ main(argc, argv)
}
}
- filelist = fileptr = (char **)malloc(argc*sizeof(char *));
+ filelist = (char **)malloc(argc*sizeof(char *));
+ if (filelist == NULL)
+ {
+ fprintf(stderr, "Cannot allocate memory for file list.\n");
+ exit (1);
+ }
+ fileptr = filelist;
*filelist = NULL;
if((progname = rindex(argv[0], '/')) != 0)
@@ -836,6 +843,7 @@ nextarg: continue;
decompress(0, 1);
}
+ free(filelist);
exit((exit_code== -1) ? 1:exit_code);
return 0;
}

View File

@ -1,10 +1,10 @@
Summary: Fast compression and decompression utilities
Name: ncompress
Version: 4.2.4
Release: 50%{?dist}
Release: 51%{?dist}
License: Public Domain
Group: Applications/File
URL: ftp://sunsite.unc.edu/pub/Linux/utils/compress/
URL: http://ncompress.sourceforge.net/
Source: ftp://metalab.unc.edu/pub/Linux/utils/compress/%{name}-%{version}.tar.Z
Patch0: ncompress-4.2.4-make.patch
Patch1: ncompress-4.2.4-lfs2.patch
@ -13,6 +13,7 @@ Patch3: ncompress-2GB.patch
Patch4: ncompress-4.2.4-zerobyteforce.patch
Patch5: ncompress-4.2.4-bssUnderflow.patch
Patch6: ncompress-4.2.4-endians.patch
Patch7: ncompress-4.2.4-uncheckedmalloc.patch
BuildRequires: gcc glibc-devel fileutils
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -35,6 +36,7 @@ which are compatible with the original UNIX compress utility.
%patch4 -p1 -b .zerobyteforce
%patch5 -p1 -b .bssUnderflow
%patch6 -p1 -b .endians
%patch7 -p1 -b .malloccheck
%build
@ -71,6 +73,11 @@ rm -rf $RPM_BUILD_ROOT
%doc LZW.INFO README
%changelog
* Mon Dec 01 2008 Ondrej Vasik <ovasik@redhat.com> - 4.2.4-51
- check malloc success (#473488)
- fix few compiler warnings, free malloc memory before exit
- new URL
* Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 4.2.4-50
- Autorebuild for GCC 4.3