4056. [bug] Fixed several small bugs in automatic trust anchor management, including a memory leak and a possible loss of key state information. [RT #38458]