summaryrefslogtreecommitdiffstats
path: root/sys/geom
diff options
context:
space:
mode:
authortrociny <trociny@FreeBSD.org>2011-05-15 12:39:30 +0000
committertrociny <trociny@FreeBSD.org>2011-05-15 12:39:30 +0000
commitf698adac68a0008534dfc805ef229ec9790c5c4f (patch)
treee9c272ea7ee5c66482dd82bc0e4a249e2efb21bd /sys/geom
parent695fda3e9b7f26d089e524ca74ad7f403dba0628 (diff)
downloadFreeBSD-src-f698adac68a0008534dfc805ef229ec9790c5c4f.zip
FreeBSD-src-f698adac68a0008534dfc805ef229ec9790c5c4f.tar.gz
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
Diffstat (limited to 'sys/geom')
-rw-r--r--sys/geom/eli/g_eli_key_cache.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/geom/eli/g_eli_key_cache.c b/sys/geom/eli/g_eli_key_cache.c
index 0a5a9ca..de4989b 100644
--- a/sys/geom/eli/g_eli_key_cache.c
+++ b/sys/geom/eli/g_eli_key_cache.c
@@ -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 {
OpenPOWER on IntegriCloud