When removing a variable from its hash chain, assign to the 'next' pointer of the previous link rather than the hash bucket. --- src/var.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/var.c b/src/var.c index f456fbd..c0e5706 100644 --- a/src/var.c +++ b/src/var.c @@ -238,11 +238,11 @@ intmax_t setvarint(const char *name, intmax_t val, int flags) void setvareq(char *s, int flags) { - struct var *vp, **vpp; + struct var *vp, **vpp, **fvpp; vpp = hashvar(s); flags |= (VEXPORT & (((unsigned) (1 - aflag)) - 1)); - vp = *findvar(vpp, s); + vp = *(fvpp = findvar(vpp, s)); if (vp) { if (vp->flags & VREADONLY) { const char *n; @@ -265,7 +265,7 @@ setvareq(char *s, int flags) if (((flags & (VEXPORT|VREADONLY|VSTRFIXED|VUNSET)) | (vp->flags & VSTRFIXED)) == VUNSET) { - *vpp = vp->next; + *fvpp = vp->next; ckfree(vp); out_free: if ((flags & (VTEXTFIXED|VSTACK|VNOSAVE)) == VNOSAVE) -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe dash" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html