Skip to contentSkip to conversation

No memory release after enlarge fib_info hash table

Question Yan Zheng 1 participant 1 message Aug 3, 2005

lore
Share & tools
lore

Yan Zheng

author
#0 lore raw

linux 2.6.12.3

net/ipv4/fib_semantics.c:line 679

       if (fib_info_cnt >= fib_hash_size) {
               unsigned int new_size = fib_hash_size << 1;
               struct hlist_head *new_info_hash;
               struct hlist_head *new_laddrhash;
               unsigned int bytes;

               if (!new_size)
                       new_size = 1;
               bytes = new_size * sizeof(struct hlist_head *);
               new_info_hash = fib_hash_alloc(bytes);
               new_laddrhash = fib_hash_alloc(bytes);
               if (!new_info_hash || !new_laddrhash) {
                       fib_hash_free(new_info_hash, bytes);
                       fib_hash_free(new_laddrhash, bytes);
               } else {
                       memset(new_info_hash, 0, bytes);
                       memset(new_laddrhash, 0, bytes);

                       fib_hash_move(new_info_hash, new_laddrhash, 
new_size);
               }

               if (!fib_hash_size)
                       goto failure;
       }

In fib_hash_move, there is no code call fib_hash_free to release memory used by old hash table. after call fib_hash_move, fib_info_hash and fib_info_laddrhash are the new memory addresses , old addresses are lost. Is this a bug?

thanks