diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-04-26 17:55:47 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-04-26 17:55:47 +0000 |
commit | 785cba52cbeec67e4fbb24881e1f9c44810fd6f2 (patch) | |
tree | 292d8902c681072a369a5f271dfa8bd19c851efb /usr.bin | |
parent | e5988675c9ef9690158f92b37803b7764987109b (diff) |
fix free before last use; charnier
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/oldrdist/docmd.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.bin/oldrdist/docmd.c b/usr.bin/oldrdist/docmd.c index 2717e5c8e9f..e6d9c7f5005 100644 --- a/usr.bin/oldrdist/docmd.c +++ b/usr.bin/oldrdist/docmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: docmd.c,v 1.10 1997/11/16 18:51:59 deraadt Exp $ */ +/* $OpenBSD: docmd.c,v 1.11 1998/04/26 17:55:46 deraadt Exp $ */ /* * Copyright (c) 1983, 1993 @@ -35,7 +35,7 @@ #ifndef lint /* from: static char sccsid[] = "@(#)docmd.c 8.1 (Berkeley) 6/9/93"; */ -static char *rcsid = "$OpenBSD: docmd.c,v 1.10 1997/11/16 18:51:59 deraadt Exp $"; +static char *rcsid = "$OpenBSD: docmd.c,v 1.11 1998/04/26 17:55:46 deraadt Exp $"; #endif /* not lint */ #include "defs.h" @@ -192,13 +192,16 @@ done: if (sc->sc_type == NOTIFY) notify(tempfile, rhost, sc->sc_args, 0); if (!nflag) { + struct linkbuf *nextihead; + (void) unlink(tempfile); - for (; ihead != NULL; ihead = ihead->nextp) { - free(ihead); + for (; ihead != NULL; ihead = nextihead) { + nextihead = ihead->nextp; if ((opts & IGNLNKS) || ihead->count == 0) continue; log(lfp, "%s: Warning: missing links\n", ihead->pathname); + free(ihead); } } } |