aboutsummaryrefslogtreecommitdiffstats
path: root/lang
diff options
context:
space:
mode:
authorkrion <krion@FreeBSD.org>2007-09-04 04:18:36 +0800
committerkrion <krion@FreeBSD.org>2007-09-04 04:18:36 +0800
commitfb22e2705ac7d746500eada684508f6d97aadd1a (patch)
treec2eb7df950edd169e76ae948cf66596051fb748f /lang
parentbc5c36d89761b238689c81c4d01724555c141919 (diff)
downloadfreebsd-ports-gnome-fb22e2705ac7d746500eada684508f6d97aadd1a.tar.gz
freebsd-ports-gnome-fb22e2705ac7d746500eada684508f6d97aadd1a.tar.zst
freebsd-ports-gnome-fb22e2705ac7d746500eada684508f6d97aadd1a.zip
Fix coredump while running with nonexistent files.
PR: ports/115014 Submitted by: Kirill Nuzhdin <kirill@rad.chem.msu.ru>
Diffstat (limited to 'lang')
-rw-r--r--lang/gawk/files/patch-io.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/lang/gawk/files/patch-io.c b/lang/gawk/files/patch-io.c
new file mode 100644
index 000000000000..9d8f06f8c2fc
--- /dev/null
+++ b/lang/gawk/files/patch-io.c
@@ -0,0 +1,29 @@
+
+$FreeBSD$
+
+--- io.c.orig
++++ io.c
+@@ -2480,9 +2480,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;
+@@ -2495,7 +2498,8 @@
+ }
+
+ if (iop->fd == INVALID_HANDLE) {
+- free(iop);
++ if (iop_malloced)
++ free(iop);
+ return NULL;
+ }
+ if (isatty(iop->fd))