diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2015-03-24 22:34:40 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2015-03-24 22:34:40 +0000 |
commit | 25f64aa8a945b4a2689ef7d8abe56b6fb59694fd (patch) | |
tree | cda35b4b85dd0c30cbd96eaea837d6a88d1552d9 /usr.bin | |
parent | 35e67f90d689c6d405c22042bedce88931fb1a0b (diff) |
When exiting the loop early don't forget to clean up.
This fixes a segfault reported by and tracked down by Kaspars
Bankovskis kaspars at bankovskis dot net, thanks!
OK bcallah@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/mg/basic.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/mg/basic.c b/usr.bin/mg/basic.c index fdbb3646309..f8a93e13df0 100644 --- a/usr.bin/mg/basic.c +++ b/usr.bin/mg/basic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: basic.c,v 1.44 2015/03/19 21:22:15 bcallah Exp $ */ +/* $OpenBSD: basic.c,v 1.45 2015/03/24 22:34:39 florian Exp $ */ /* This file is in the public domain */ @@ -378,10 +378,11 @@ backpage(int f, int n) /* Move the dot the slow way, for line nos */ while (curwp->w_dotp != lp2) { if (curwp->w_dotline <= curwp->w_ntrows) - return (TRUE); + goto out; curwp->w_dotp = lback(curwp->w_dotp); curwp->w_dotline--; } +out: curwp->w_doto = 0; return (TRUE); } |