From 680ca3b13d52422ea165f09173c82c8ba26e73c5 Mon Sep 17 00:00:00 2001 From: Pawel Dziepak Date: Thu, 8 May 2014 23:05:31 +0200 Subject: [PATCH] runtime_loader: fix CID 1211995, improve generation counting There is no need to increase generation counter each time new DSO is registered. --- src/system/runtime_loader/elf_tls.cpp | 10 +++++++++- src/system/runtime_loader/elf_tls.h | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/system/runtime_loader/elf_tls.cpp b/src/system/runtime_loader/elf_tls.cpp index 3a17f731b4..40bc66c006 100644 --- a/src/system/runtime_loader/elf_tls.cpp +++ b/src/system/runtime_loader/elf_tls.cpp @@ -116,7 +116,7 @@ TLSBlockTemplates::Register(const TLSBlockTemplate& block) fTemplates.push_back(block); } - fTemplates[dso].SetGeneration(fGeneration++); + fTemplates[dso].SetGeneration(fGeneration); return dso; } @@ -127,6 +127,7 @@ TLSBlockTemplates::Unregister(unsigned dso) if (dso == unsigned(-1)) return; + fGeneration++; fFreeDSOs.push_back(dso); } @@ -155,6 +156,13 @@ TLSBlockTemplates::CreateBlock(unsigned dso) } +TLSBlockTemplates::TLSBlockTemplates() + : + fGeneration(0) +{ +} + + TLSBlock::TLSBlock() : fPointer(NULL) diff --git a/src/system/runtime_loader/elf_tls.h b/src/system/runtime_loader/elf_tls.h index 0fa7a07497..9e8d859b10 100644 --- a/src/system/runtime_loader/elf_tls.h +++ b/src/system/runtime_loader/elf_tls.h @@ -48,7 +48,7 @@ public: TLSBlock CreateBlock(unsigned dso); private: - TLSBlockTemplates() { } + inline TLSBlockTemplates(); static TLSBlockTemplates* fInstance;