summaryrefslogtreecommitdiff
path: root/community/squid/squid-r13407.patch
diff options
context:
space:
mode:
Diffstat (limited to 'community/squid/squid-r13407.patch')
-rw-r--r--community/squid/squid-r13407.patch57
1 files changed, 57 insertions, 0 deletions
diff --git a/community/squid/squid-r13407.patch b/community/squid/squid-r13407.patch
new file mode 100644
index 000000000..6ec937cf5
--- /dev/null
+++ b/community/squid/squid-r13407.patch
@@ -0,0 +1,57 @@
+@@ -, +, @@
+ author: Alex Rousskov <rousskov@measurement-factory.com>
+ Avoid on-exit crashes when adaptation is enabled.
+
+ After trunk r13269 (Vector refactor) destroyed vector objects still have
+ positive item counts. This exposes use-after-delete bugs. In this particular
+ case, global adaptation rule/group/service arrays are destructed by global
+ destruction sequence first and then again by Adaptation::*::TheConfig objects
+ destructors.
+
+ This change avoiding static destruction order dependencies by storing those
+ global adaptation arrays on heap.
+--- src/adaptation/AccessRule.cc 2014-06-03 07:05:07 +0000
++++ src/adaptation/AccessRule.cc 2014-06-29 15:22:19 +0000
+@@ -51,10 +51,10 @@ Adaptation::AccessRule::group()
+
+ Adaptation::AccessRules &
+ Adaptation::AllRules()
+ {
+- static AccessRules TheRules;
+- return TheRules;
++ static AccessRules *TheRules = new AccessRules;
++ return *TheRules;
+ }
+
+ // TODO: make AccessRules::find work
+ Adaptation::AccessRule *
+--- src/adaptation/Service.cc 2012-08-28 13:00:30 +0000
++++ src/adaptation/Service.cc 2014-06-29 15:22:19 +0000
+@@ -53,10 +53,10 @@ Adaptation::Service::wants(const Service
+
+ Adaptation::Services &
+ Adaptation::AllServices()
+ {
+- static Services TheServices;
+- return TheServices;
++ static Services *TheServices = new Services;
++ return *TheServices;
+ }
+
+ Adaptation::ServicePointer
+ Adaptation::FindService(const Service::Id& key)
+--- src/adaptation/ServiceGroups.cc 2013-09-28 13:03:58 +0000
++++ src/adaptation/ServiceGroups.cc 2014-06-29 15:22:19 +0000
+@@ -314,10 +314,10 @@ Adaptation::ServicePlan::print(std::ostr
+
+ Adaptation::Groups &
+ Adaptation::AllGroups()
+ {
+- static Groups TheGroups;
+- return TheGroups;
++ static Groups *TheGroups = new Groups;
++ return *TheGroups;
+ }
+
+ Adaptation::ServiceGroupPointer
+ Adaptation::FindGroup(const ServiceGroup::Id &id)