Fix a memory leak possible in g_eli_key_allocate() if the key with the

same keyno is added while we aren't holding the lock.

Approved by:	pjd (mentor)
MFC after:	1 week
This commit is contained in:
Mikolaj Golub 2011-05-15 12:39:30 +00:00
parent cb86ada75d
commit 76cc7f6dd6

View File

@ -124,6 +124,7 @@ g_eli_key_allocate(struct g_eli_softc *sc, uint64_t keyno)
ekey = RB_FIND(g_eli_key_tree, &sc->sc_ekeys_tree, &keysearch);
if (ekey != NULL) {
bzero(key, sizeof(*key));
free(key, M_ELI);
key = ekey;
TAILQ_REMOVE(&sc->sc_ekeys_queue, key, gek_next);
} else {