- fix free usage

This commit is contained in:
kzak 2005-09-27 17:25:41 +00:00
parent 9538ce397b
commit 8d4cb7ede3
2 changed files with 41 additions and 1 deletions

35
gawk-3.1.5-free.patch Normal file
View File

@ -0,0 +1,35 @@
--- gawk-3.1.5/io.c.free 2005-09-27 19:21:05.000000000 +0200
+++ gawk-3.1.5/io.c 2005-09-27 19:22:58.000000000 +0200
@@ -2479,9 +2479,12 @@
{
struct stat sbuf;
struct open_hook *oh;
+ int iop_malloced = FALSE;
- if (iop == NULL)
+ if (iop == NULL) {
emalloc(iop, IOBUF *, sizeof(IOBUF), "iop_alloc");
+ iop_malloced = TRUE;
+ }
memset(iop, '\0', sizeof(IOBUF));
iop->flag = 0;
iop->fd = fd;
@@ -2494,7 +2497,8 @@
}
if (iop->fd == INVALID_HANDLE) {
- free(iop);
+ if (iop_malloced)
+ free(iop);
return NULL;
}
if (isatty(iop->fd))
@@ -2502,7 +2506,7 @@
iop->readsize = iop->size = optimal_bufsize(iop->fd, & sbuf);
iop->sbuf = sbuf;
if (do_lint && S_ISREG(sbuf.st_mode) && sbuf.st_size == 0)
- lintwarn(_("data file `%s' is empty"), name);
+ lintwarn(_("data file `%s' is empty"), name);
errno = 0;
iop->count = iop->scanoff = 0;
emalloc(iop->buf, char *, iop->size += 2, "iop_alloc");

View File

@ -1,12 +1,13 @@
Summary: The GNU version of the awk text processing utility.
Name: gawk
Version: 3.1.5
Release: 2
Release: 3
License: GPL
Group: Applications/Text
Source0: ftp://ftp.gnu.org/gnu/gawk/gawk-%{version}.tar.bz2
Source1: ftp://ftp.gnu.org/gnu/gawk/gawk-%{version}-ps.tar.gz
Patch1: gawk-3.1.3-getpgrp_void.patch
Patch2: gawk-3.1.5-free.patch
Prereq: /sbin/install-info
Requires: /bin/mktemp
Buildroot: %{_tmppath}/%{name}-root
@ -22,6 +23,7 @@ considered to be a standard Linux tool for processing text.
%prep
%setup -q -b 1
%patch1 -p1 -b .getpgrp_void
%patch2 -p1 -b .free
%build
%configure
@ -70,6 +72,9 @@ fi
%{_datadir}/awk
%changelog
* Tue Sep 27 2005 Karel Zak <kzak@redhat.com> 3.1.5-3
- fix #169374 - Invalid Free (patch by Aharon Robbins)
* Tue Sep 20 2005 Karel Zak <kzak@redhat.com> 3.1.5-2
- fix #167181 - gawk owns /usr/share
- fix #160634 - should exclude dirs in spec file