When iterating the host list, do not access memory that has just been
free()'d. From Matt Beal <beal@umiacs.umd.edu>, PR #2747.
This commit is contained in:
parent
2b5e1cd158
commit
65f3b15dc2
@ -1,5 +1,5 @@
|
|||||||
%{
|
%{
|
||||||
/* $NetBSD: gram.y,v 1.5 1996/07/12 00:46:24 thorpej Exp $ */
|
/* $NetBSD: gram.y,v 1.6 1996/09/10 18:48:57 thorpej Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1983, 1993
|
* Copyright (c) 1983, 1993
|
||||||
@ -38,7 +38,7 @@
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)gram.y 8.1 (Berkeley) 6/9/93";
|
static char sccsid[] = "@(#)gram.y 8.1 (Berkeley) 6/9/93";
|
||||||
#else
|
#else
|
||||||
static char *rcsid = "$NetBSD: gram.y,v 1.5 1996/07/12 00:46:24 thorpej Exp $";
|
static char *rcsid = "$NetBSD: gram.y,v 1.6 1996/09/10 18:48:57 thorpej Exp $";
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
@ -373,11 +373,11 @@ insert(label, files, hosts, subcmds)
|
|||||||
struct subcmd *subcmds;
|
struct subcmd *subcmds;
|
||||||
{
|
{
|
||||||
register struct cmd *c, *prev, *nc;
|
register struct cmd *c, *prev, *nc;
|
||||||
register struct namelist *h;
|
register struct namelist *h, *nexth;
|
||||||
|
|
||||||
files = expand(files, E_VARS|E_SHELL);
|
files = expand(files, E_VARS|E_SHELL);
|
||||||
hosts = expand(hosts, E_ALL);
|
hosts = expand(hosts, E_ALL);
|
||||||
for (h = hosts; h != NULL; free(h), h = h->n_next) {
|
for (h = hosts; h != NULL; nexth = h->n_next, free(h), h = nexth) {
|
||||||
/*
|
/*
|
||||||
* Search command list for an update to the same host.
|
* Search command list for an update to the same host.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user