]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: lru: do not allocate useless memory in lru64_lookup
authorChristopher Faulet <cfaulet@qualys.com>
Tue, 28 Jul 2015 14:01:07 +0000 (16:01 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 9 Oct 2015 08:13:18 +0000 (10:13 +0200)
lru64_lookup function was added in a previous patch of mine. This one
just remove a useless memory allocation.

src/lru.c

index 4a46505f334d46b33e5456fb79460f62ee92799c..719fe075e68c2ba75ec5b82d094ef806814f9eb5 100644 (file)
--- a/src/lru.c
+++ b/src/lru.c
@@ -39,15 +39,6 @@ struct lru64 *lru64_lookup(unsigned long long key, struct lru64_head *lru,
        struct eb64_node *node;
        struct lru64 *elem;
 
-       if (!lru->spare) {
-               if (!lru->cache_size)
-                       return NULL;
-               lru->spare = malloc(sizeof(*lru->spare));
-               if (!lru->spare)
-                       return NULL;
-               lru->spare->domain = NULL;
-       }
-
        node = __eb64_lookup(&lru->keys, key);
        elem = container_of(node, typeof(*elem), node);
        if (elem) {