diff --git a/CHANGES b/CHANGES index 44c6a83484..da3a04bc18 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,11 @@ +2.6-616 | 2019-07-16 15:21:37 +0000 + + * Fix referecne counting bug in EnumType copy constructor. (Jon + Siwek, Corelight) + + * Remove unused BroObj::in_ser_cache member. (Jon Siwek, Corelight) + 2.6-612 | 2019-07-15 19:46:04 -0700 * Fix a potential usage of List::remove_nth(-1) (Jon Siwek, Corelight) diff --git a/VERSION b/VERSION index e6aa2f840a..e3ec0cf2b1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.6-612 +2.6-616 diff --git a/src/Type.cc b/src/Type.cc index f0605c9a06..498763a0f8 100644 --- a/src/Type.cc +++ b/src/Type.cc @@ -1088,6 +1088,9 @@ EnumType::EnumType(const EnumType* e) names[it->first] = it->second; vals = e->vals; + + for ( auto& kv : vals ) + ::Ref(kv.second); } EnumType* EnumType::ShallowClone() diff --git a/testing/btest/Baseline/language.enum-multiple-decls/out b/testing/btest/Baseline/language.enum-multiple-decls/out new file mode 100644 index 0000000000..a2628c1e09 --- /dev/null +++ b/testing/btest/Baseline/language.enum-multiple-decls/out @@ -0,0 +1 @@ +ONE diff --git a/testing/btest/language/enum-multiple-decls.zeek b/testing/btest/language/enum-multiple-decls.zeek new file mode 100644 index 0000000000..f921ca120f --- /dev/null +++ b/testing/btest/language/enum-multiple-decls.zeek @@ -0,0 +1,10 @@ +# @TEST-EXEC: zeek -b %INPUT >out +# @TEST-EXEC: btest-diff out + +# At the moment, it's legal to allow a double definitions. Internally, the +# reason/comment is: "so that we can define an enum both in a *.bif and *.zeek +# for avoiding cyclic dependencies." + +type myenum: enum { ONE = 0x01 }; +type myenum: enum { ONE = 0x01 }; +print ONE;