Sophie

Sophie

distrib > * > 2008.0 > x86_64 > by-pkgid > 18ba08490400132dbde6994df4d123d5 > files > 2

gawk-3.1.5-3mdv2008.0.src.rpm

--- io.c	2006/01/17 13:17:28	1.1
+++ io.c	2006/01/17 13:54:10
@@ -2479,8 +2479,9 @@
 {
 	struct stat sbuf;
 	struct open_hook *oh;
+	int iopwasnull = iop == NULL;
 
-	if (iop == NULL)
+	if (iopwasnull)
 		emalloc(iop, IOBUF *, sizeof(IOBUF), "iop_alloc");
 	memset(iop, '\0', sizeof(IOBUF));
 	iop->flag = 0;
@@ -2494,7 +2495,7 @@
 	}
 
 	if (iop->fd == INVALID_HANDLE) {
-		free(iop);
+		if (iopwasnull) free(iop);
 		return NULL;
 	}
 	if (isatty(iop->fd))