diff --git a/CHANGES b/CHANGES index c552bbb2d3..e75c6ebfc7 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,8 @@ +2.6-111 | 2019-01-29 18:17:35 -0600 + + * Fix memory leak due to enum type/val circular references (Jon Siwek, Corelight) + 2.6-110 | 2019-01-29 14:49:10 -0800 * Add fuid to SSL:Invalid_Server_Cert notice (Stephen Hosom) diff --git a/VERSION b/VERSION index a65d034b05..2f7a81dba6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.6-110 +2.6-111 diff --git a/src/Type.cc b/src/Type.cc index 6ed1ce08b8..77a5ac6d16 100644 --- a/src/Type.cc +++ b/src/Type.cc @@ -1714,7 +1714,12 @@ bool EnumType::DoUnserialize(UnserialInfo* info) names[name] = val; delete [] name; // names[name] converts to std::string - vals[val] = new EnumVal(this, val); + // note: the 'vals' map gets populated lazily, which works fine and + // also happens to avoid a leak due to circular reference between the + // types and vals (there's a special case for unserializing a known + // type that will unserialze and then immediately want to unref the + // type if we already have it, except that won't delete it as intended + // if we've already created circular references to it here). } return true; diff --git a/testing/btest/Baseline/core.leaks.broker.remote_event/send.send.out b/testing/btest/Baseline/core.leaks.broker.remote_event/send.send.out index 61c732410c..7446e7ac5d 100644 --- a/testing/btest/Baseline/core.leaks.broker.remote_event/send.send.out +++ b/testing/btest/Baseline/core.leaks.broker.remote_event/send.send.out @@ -1,4 +1,4 @@ -Broker peer added, [address=127.0.0.1, bound_port=9999/tcp] +Broker peer added, 127.0.0.1 got event msg, pong, 0 got auto event msg, ping, 0 got event msg, pong, 1 diff --git a/testing/btest/Baseline/core.leaks.broker.remote_log/send.send.out b/testing/btest/Baseline/core.leaks.broker.remote_log/send.send.out index f1d017bb24..b467bc6375 100644 --- a/testing/btest/Baseline/core.leaks.broker.remote_log/send.send.out +++ b/testing/btest/Baseline/core.leaks.broker.remote_log/send.send.out @@ -1 +1 @@ -Broker peer added, [address=127.0.0.1, bound_port=9999/tcp] +Broker peer added, 127.0.0.1 diff --git a/testing/external/commit-hash.zeek-testing b/testing/external/commit-hash.zeek-testing index fc82db5253..5ec3d9d5e4 100644 --- a/testing/external/commit-hash.zeek-testing +++ b/testing/external/commit-hash.zeek-testing @@ -1 +1 @@ -42fd25c235d0c10319c3597d23f113dbbd89567f +2f7a827cc339fc14b0c978c986fa776dd9e7903c diff --git a/testing/external/commit-hash.zeek-testing-private b/testing/external/commit-hash.zeek-testing-private index 28110e311a..310cc69417 100644 --- a/testing/external/commit-hash.zeek-testing-private +++ b/testing/external/commit-hash.zeek-testing-private @@ -1 +1 @@ -e71c2dc19eabc68f590381f52a53a207f3b92f78 +60170dfea85dedd4dc9bece020d0614f04d7f30e