summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvincent <vincent@openbsd.org>2004-01-15 20:55:47 +0000
committervincent <vincent@openbsd.org>2004-01-15 20:55:47 +0000
commit98b20e326900e3a151e7e43d41c6f312ffc09f17 (patch)
tree5b773af6189614b3b121f1dc2e3d022172e5ae0a
parentFix printf format string. ok tedu@ (diff)
downloadwireguard-openbsd-98b20e326900e3a151e7e43d41c6f312ffc09f17.tar.xz
wireguard-openbsd-98b20e326900e3a151e7e43d41c6f312ffc09f17.zip
fix an early free that made compile-goto-error work only from time to time
-rw-r--r--usr.bin/mg/grep.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/mg/grep.c b/usr.bin/mg/grep.c
index e51a39faa65..9223eb033b6 100644
--- a/usr.bin/mg/grep.c
+++ b/usr.bin/mg/grep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grep.c,v 1.9 2003/11/09 00:16:36 vincent Exp $ */
+/* $OpenBSD: grep.c,v 1.10 2004/01/15 20:55:47 vincent Exp $ */
/*
* Copyright (c) 2001 Artur Grabowski <art@openbsd.org>. All rights reserved.
*
@@ -213,11 +213,13 @@ retry:
lineno = strtol(ln, &lp1, 10);
if (lp != lp1 + 1)
goto fail;
- free(line);
adjf = adjustname(fname);
+ free(line);
+
if (adjf == NULL)
return (FALSE);
+
if ((bp = findbuffer(adjf)) == NULL)
return FALSE;
if ((wp = popbuf(bp)) == NULL)