1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-15 01:04:37 +02:00

Remove unnecessary mem contexts in the Manifest object.

The correct context is set by the various *Add() functions so these are not needed and cause leaks, though the leaks will only be noticeable in cases where there are a lot of page checksum errors.
This commit is contained in:
David Steele
2022-04-20 19:31:35 -04:00
parent da9f261852
commit d6f466be2b

View File

@ -1761,8 +1761,6 @@ manifestLoadCallback(void *callbackData, const String *section, const String *ke
{ {
KeyValue *fileKv = varKv(value); KeyValue *fileKv = varKv(value);
MEM_CONTEXT_BEGIN(lstMemContext(manifest->pub.fileList))
{
ManifestFile file = ManifestFile file =
{ {
.name = key, .name = key,
@ -1846,16 +1844,11 @@ manifestLoadCallback(void *callbackData, const String *section, const String *ke
manifestFileAdd(manifest, &file); manifestFileAdd(manifest, &file);
} }
MEM_CONTEXT_END();
}
// ----------------------------------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------------------------------
else if (strEq(section, MANIFEST_SECTION_TARGET_PATH_STR)) else if (strEq(section, MANIFEST_SECTION_TARGET_PATH_STR))
{ {
KeyValue *pathKv = varKv(value); KeyValue *pathKv = varKv(value);
MEM_CONTEXT_BEGIN(lstMemContext(manifest->pub.pathList))
{
ManifestLoadFound valueFound = {0}; ManifestLoadFound valueFound = {0};
ManifestPath path = ManifestPath path =
@ -1884,16 +1877,12 @@ manifestLoadCallback(void *callbackData, const String *section, const String *ke
lstAdd(loadData->pathFoundList, &valueFound); lstAdd(loadData->pathFoundList, &valueFound);
manifestPathAdd(manifest, &path); manifestPathAdd(manifest, &path);
} }
MEM_CONTEXT_END();
}
// ----------------------------------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------------------------------
else if (strEq(section, MANIFEST_SECTION_TARGET_LINK_STR)) else if (strEq(section, MANIFEST_SECTION_TARGET_LINK_STR))
{ {
KeyValue *linkKv = varKv(value); KeyValue *linkKv = varKv(value);
MEM_CONTEXT_BEGIN(lstMemContext(manifest->pub.linkList))
{
ManifestLoadFound valueFound = {0}; ManifestLoadFound valueFound = {0};
ManifestLink link = ManifestLink link =
@ -1917,8 +1906,6 @@ manifestLoadCallback(void *callbackData, const String *section, const String *ke
lstAdd(loadData->linkFoundList, &valueFound); lstAdd(loadData->linkFoundList, &valueFound);
manifestLinkAdd(manifest, &link); manifestLinkAdd(manifest, &link);
} }
MEM_CONTEXT_END();
}
// ----------------------------------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------------------------------
else if (strEq(section, MANIFEST_SECTION_TARGET_FILE_DEFAULT_STR)) else if (strEq(section, MANIFEST_SECTION_TARGET_FILE_DEFAULT_STR))
@ -1989,8 +1976,6 @@ manifestLoadCallback(void *callbackData, const String *section, const String *ke
{ {
KeyValue *dbKv = varKv(value); KeyValue *dbKv = varKv(value);
MEM_CONTEXT_BEGIN(lstMemContext(manifest->pub.dbList))
{
ManifestDb db = ManifestDb db =
{ {
.name = strDup(key), .name = strDup(key),
@ -2000,8 +1985,6 @@ manifestLoadCallback(void *callbackData, const String *section, const String *ke
manifestDbAdd(manifest, &db); manifestDbAdd(manifest, &db);
} }
MEM_CONTEXT_END();
}
// ----------------------------------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------------------------------
else if (strEq(section, MANIFEST_SECTION_BACKUP_STR)) else if (strEq(section, MANIFEST_SECTION_BACKUP_STR))