aboutsummaryrefslogtreecommitdiff
path: root/sys/geom/eli
diff options
context:
space:
mode:
authorMikolaj Golub <trociny@FreeBSD.org>2011-05-15 12:39:30 +0000
committerMikolaj Golub <trociny@FreeBSD.org>2011-05-15 12:39:30 +0000
commit76cc7f6dd6701da0163e11d3cbd0a37209584731 (patch)
treee9c272ea7ee5c66482dd82bc0e4a249e2efb21bd /sys/geom/eli
parentcb86ada75ddbf6d7ca887a42bcc1d33b9da4328d (diff)
downloadsrc-76cc7f6dd6701da0163e11d3cbd0a37209584731.tar.gz
src-76cc7f6dd6701da0163e11d3cbd0a37209584731.zip
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
Notes
Notes: svn path=/head/; revision=221953
Diffstat (limited to 'sys/geom/eli')
-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 0a5a9ca6e8d3..de4989b72f6c 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 {