pushinit(): fix a use-after-free bug.
This commit is contained in:
parent
dade97a1c0
commit
c89ec7afee
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: init.c,v 1.21 2006/10/15 18:18:54 christos Exp $ */
|
||||
/* $NetBSD: init.c,v 1.22 2007/01/20 21:16:23 ad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Jochen Pohl
|
||||
@ -37,7 +37,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(__RCSID) && !defined(lint)
|
||||
__RCSID("$NetBSD: init.c,v 1.21 2006/10/15 18:18:54 christos Exp $");
|
||||
__RCSID("$NetBSD: init.c,v 1.22 2007/01/20 21:16:23 ad Exp $");
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
@ -247,7 +247,7 @@ pushinit(void)
|
||||
#ifdef DEBUG
|
||||
char buf[64];
|
||||
#endif
|
||||
istk_t *istk;
|
||||
istk_t *istk, *inxt;
|
||||
int cnt;
|
||||
sym_t *m;
|
||||
|
||||
@ -369,8 +369,9 @@ again:
|
||||
if (namedmem) {
|
||||
DPRINTF(("pushinit(): pop\n"));
|
||||
pop:
|
||||
inxt = initstk->i_nxt;
|
||||
free(istk);
|
||||
initstk = initstk->i_nxt;
|
||||
initstk = inxt;
|
||||
goto again;
|
||||
}
|
||||
istk->i_cnt = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user