Fix memory leak due to enum type/val circular references

Introduced in 2982765128
This commit is contained in:
Jon Siwek 2019-01-29 18:17:35 -06:00
parent 2e2f611df5
commit 49a30d61cf
7 changed files with 15 additions and 6 deletions

View file

@ -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)

View file

@ -1 +1 @@
2.6-110
2.6-111

View file

@ -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;

View file

@ -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

View file

@ -1 +1 @@
Broker peer added, [address=127.0.0.1, bound_port=9999/tcp]
Broker peer added, 127.0.0.1

View file

@ -1 +1 @@
42fd25c235d0c10319c3597d23f113dbbd89567f
2f7a827cc339fc14b0c978c986fa776dd9e7903c

View file

@ -1 +1 @@
e71c2dc19eabc68f590381f52a53a207f3b92f78
60170dfea85dedd4dc9bece020d0614f04d7f30e