From 4e438bf4224b3efef67b78d182761015ba8d0bf4 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 7 Feb 2020 11:16:17 +0100 Subject: [PATCH] Obj: disallow copying BroObj Copying a BroObj is dangerous, and should only be done with dedicated (virtual) methods which are implemented by all derived classes. This commit avoids unintentional copies. --- src/Obj.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Obj.h b/src/Obj.h index 9920e5c588..c175459a5d 100644 --- a/src/Obj.h +++ b/src/Obj.h @@ -73,6 +73,10 @@ public: virtual ~BroObj(); + /* disallow copying */ + BroObj(const BroObj &) = delete; + BroObj &operator=(const BroObj &) = delete; + // Report user warnings/errors. If obj2 is given, then it's // included in the message, though if pinpoint_only is non-zero, // then obj2 is only used to pinpoint the location.