head 1.2; access; symbols; locks; strict; comment @# @; 1.2 date 2007.10.26.07.44.35; author rse; state dead; branches; next 1.1; commitid a833DOnw17PrB4Ds; 1.1 date 2007.09.04.08.26.56; author rse; state Exp; branches; next ; commitid 1ElIer8G0THBvows; desc @@ 1.2 log @upgrading package: gawk 3.1.5 -> 3.1.6 @ text @Fix coredump while running with nonexistent files (via FreeBSD ports) Index: io.c --- io.c.orig 2005-07-26 20:07:43 +0200 +++ io.c 2007-09-04 10:24:29 +0200 @@@@ -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)) @ 1.1 log @Fix coredump while running with nonexistent files (via FreeBSD ports) @ text @@