src: introduce upx::atomic_exchange; cleanups

This commit is contained in:
Markus F.X.J. Oberhumer
2024-05-07 10:05:44 +02:00
parent e5546bc8b0
commit 3d82f0cfe1
10 changed files with 174 additions and 70 deletions
+3 -3
View File
@@ -512,7 +512,7 @@ void PeFile32::processRelocs() // pass1
infoWarning("skipping unsupported relocation type %d (%d)", ic, counts[ic]);
LE32 *fix[4];
upx::ArrayDeleter<LE32 **const> fix_deleter{fix, 0}; // don't leak memory
auto fix_deleter = upx::ArrayDeleter(fix, 0); // don't leak memory
for (unsigned ic = 0; ic <= IMAGE_REL_BASED_HIGHLOW; ic++) {
fix[ic] = New(LE32, counts[ic]);
fix_deleter.count += 1;
@@ -614,7 +614,7 @@ void PeFile64::processRelocs() // pass1
infoWarning("skipping unsupported relocation type %d (%d)", ic, counts[ic]);
LE32 *fix[16];
upx::ArrayDeleter<LE32 **const> fix_deleter{fix, 0}; // don't leak memory
auto fix_deleter = upx::ArrayDeleter(fix, 0); // don't leak memory
for (unsigned ic = 0; ic < 16; ic++) {
fix[ic] = New(LE32, counts[ic]);
fix_deleter.count += 1;
@@ -1926,7 +1926,7 @@ void PeFile::processResources(Resource *res) {
SPAN_S_VAR(byte, ores, oresources + res->dirsize());
char *keep_icons = nullptr; // icon ids in the first icon group
upx::ArrayDeleter<char **const> keep_icons_deleter{&keep_icons, 1}; // don't leak memory
const auto keep_icons_deleter = upx::ArrayDeleter(&keep_icons, 1); // don't leak memory
unsigned iconsin1stdir = 0;
if (opt->win32_pe.compress_icons == 2)
while (res->next()) // there is no rewind() in Resource