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

Add temporary mem context to removeExpiredBackup().

This was not really a leak since memory was being freed by the calling function, but this function does enough work to deserve its own memory context.

Also fixed a doubled semicolon.
This commit is contained in:
David Steele
2022-04-25 14:19:10 -04:00
parent 9314be36b1
commit fd295f002b

View File

@ -795,6 +795,8 @@ removeExpiredBackup(InfoBackup *infoBackup, const String *adhocBackupLabel, unsi
ASSERT(infoBackup != NULL);
MEM_CONTEXT_TEMP_BEGIN()
{
// Get all the current backups in backup.info - these will not be expired
StringList *currentBackupList = strLstSort(infoBackupDataLabelList(infoBackup, NULL), sortOrderDesc);
@ -844,7 +846,8 @@ removeExpiredBackup(InfoBackup *infoBackup, const String *adhocBackupLabel, unsi
if (!strLstExists(currentBackupList, strLstGet(backupList, backupIdx)))
{
LOG_INFO_FMT(
"%s: remove expired backup %s", cfgOptionGroupName(cfgOptGrpRepo, repoIdx), strZ(strLstGet(backupList, backupIdx)));
"%s: remove expired backup %s", cfgOptionGroupName(cfgOptGrpRepo, repoIdx),
strZ(strLstGet(backupList, backupIdx)));
// Execute the real expiration and deletion only if the dry-run mode is disabled
if (!cfgOptionValid(cfgOptDryRun) || !cfgOptionBool(cfgOptDryRun))
@ -855,6 +858,8 @@ removeExpiredBackup(InfoBackup *infoBackup, const String *adhocBackupLabel, unsi
}
}
}
}
MEM_CONTEXT_TEMP_END();
FUNCTION_LOG_RETURN_VOID();
}
@ -1065,7 +1070,7 @@ cmdExpire(void)
CATCH_ANY()
{
LOG_ERROR_FMT(errorTypeCode(errorType()), "%s: %s", cfgOptionGroupName(cfgOptGrpRepo, repoIdx), errorMessage());
errorTotal++;;
errorTotal++;
}
TRY_END();
}