Menu

#16 DiscoverNameServers may cause leaks, should be private

open
nobody
Bug fixes (9)
5
2007-02-06
2007-02-06
No

If DiscoverNameServers() is called repeatedly it will cause a memory leak. Each time it is called on a non-Windows system, it will append() new entries to the global default['servers'] entry. In a long-running program, this will consume all available memory if DiscovoerNameServers() is called repeatedly.

It makes better sense for this to be a part of loading the library, since it is an initialization function. My proposed patch makes a couple of the functions related to initialization private (hidden by _), makes DiscoverNameServers() a no-op (for backward compatability) and adds default server initialization to the __init__.py so it will happen when the library is loaded.

Discussion

  • Kyle VanderBeek

    Kyle VanderBeek - 2007-02-06

    Fix memory leak problem with DiscovoerNameServers()

     
  • Scott Kitterman

    Scott Kitterman - 2011-02-18

    This is, mostly, incorporated in py3dns 3.0.0. I did not make ParseResolveConf private since it's used in one of the tests.