probackup memcheck
This commit is contained in:
@ -1239,7 +1239,8 @@ pg_start_backup(const char *label, bool smooth, pgBackup *backup,
|
||||
securec_check_for_sscanf_s(ret, 2, "\0", "\0");
|
||||
/* Calculate LSN */
|
||||
startLsn = ((uint64) lsn_hi )<< 32 | lsn_lo;
|
||||
|
||||
PQclear(res);
|
||||
|
||||
if (backup_replslots) {
|
||||
logical_replslot = parray_new();
|
||||
/* query for logical replication slots of subscriptions */
|
||||
@ -1263,10 +1264,9 @@ pg_start_backup(const char *label, bool smooth, pgBackup *backup,
|
||||
elog(WARNING, "logical replication slots for subscriptions will be backed up. "
|
||||
"If don't use them after restoring, please drop them to avoid affecting xlog recycling.");
|
||||
}
|
||||
PQclear(res);
|
||||
}
|
||||
backup->start_lsn = startLsn;
|
||||
|
||||
PQclear(res);
|
||||
}
|
||||
|
||||
|
||||
@ -1355,6 +1355,7 @@ get_database_map(PGconn *conn)
|
||||
parray_append(database_map, db_entry);
|
||||
}
|
||||
|
||||
PQclear(res);
|
||||
return database_map;
|
||||
}
|
||||
|
||||
|
||||
@ -2296,28 +2296,28 @@ readBackupControlFile(const char *path)
|
||||
{
|
||||
elog(WARNING, "Control file \"%s\" is empty", path);
|
||||
pgBackupFree(backup);
|
||||
return NULL;
|
||||
backup = NULL;
|
||||
goto finish;
|
||||
}
|
||||
|
||||
if (recovery_name)
|
||||
{
|
||||
rc = snprintf_s(backup->recovery_name, lengthof(backup->recovery_name),
|
||||
lengthof(backup->recovery_name) - 1, recovery_name);
|
||||
securec_check_ss_c(rc, "\0", "\0");
|
||||
free(recovery_name);
|
||||
}
|
||||
{
|
||||
rc = snprintf_s(backup->recovery_name, lengthof(backup->recovery_name),
|
||||
lengthof(backup->recovery_name) - 1, recovery_name);
|
||||
securec_check_ss_c(rc, "\0", "\0");
|
||||
}
|
||||
|
||||
if (backup->start_time == 0)
|
||||
{
|
||||
elog(WARNING, "Invalid ID/start-time, control file \"%s\" is corrupted", path);
|
||||
pgBackupFree(backup);
|
||||
return NULL;
|
||||
backup = NULL;
|
||||
goto finish;
|
||||
}
|
||||
|
||||
if (backup_mode)
|
||||
{
|
||||
backup->backup_mode = parse_backup_mode(backup_mode);
|
||||
free(backup_mode);
|
||||
}
|
||||
|
||||
if (start_lsn)
|
||||
@ -2329,7 +2329,6 @@ readBackupControlFile(const char *path)
|
||||
backup->start_lsn = (XLogRecPtr) ((uint64) xlogid << 32) | xrecoff;
|
||||
else
|
||||
elog(WARNING, "Invalid START_LSN \"%s\"", start_lsn);
|
||||
free(start_lsn);
|
||||
}
|
||||
|
||||
if (stop_lsn)
|
||||
@ -2341,7 +2340,6 @@ readBackupControlFile(const char *path)
|
||||
backup->stop_lsn = (XLogRecPtr) ((uint64) xlogid << 32) | xrecoff;
|
||||
else
|
||||
elog(WARNING, "Invalid STOP_LSN \"%s\"", stop_lsn);
|
||||
free(stop_lsn);
|
||||
}
|
||||
|
||||
set_backup_status(status, backup);
|
||||
@ -2349,13 +2347,11 @@ readBackupControlFile(const char *path)
|
||||
if (parent_backup)
|
||||
{
|
||||
backup->parent_backup = base36dec(parent_backup);
|
||||
free(parent_backup);
|
||||
}
|
||||
|
||||
if (merge_dest_backup)
|
||||
{
|
||||
backup->merge_dest_backup = base36dec(merge_dest_backup);
|
||||
free(merge_dest_backup);
|
||||
}
|
||||
|
||||
if (program_version)
|
||||
@ -2363,7 +2359,6 @@ readBackupControlFile(const char *path)
|
||||
rc = strncpy_s(backup->program_version, sizeof(backup->program_version),program_version,
|
||||
sizeof(backup->program_version) - 1);
|
||||
securec_check_c(rc, "", "");
|
||||
pfree(program_version);
|
||||
}
|
||||
|
||||
if (server_version)
|
||||
@ -2371,14 +2366,15 @@ readBackupControlFile(const char *path)
|
||||
rc = strncpy_s(backup->server_version, sizeof(backup->server_version),server_version,
|
||||
sizeof(backup->server_version) - 1);
|
||||
securec_check_c(rc, "", "");
|
||||
pfree(server_version);
|
||||
}
|
||||
|
||||
if (compress_alg)
|
||||
if (compress_alg) {
|
||||
backup->compress_alg = parse_compress_alg(compress_alg);
|
||||
}
|
||||
|
||||
if (storage_type)
|
||||
if (storage_type) {
|
||||
backup->storage_type = str2dev(storage_type);
|
||||
}
|
||||
|
||||
if (oss_status) {
|
||||
backup->oss_status = str2ossStatus(oss_status);
|
||||
@ -2387,6 +2383,21 @@ readBackupControlFile(const char *path)
|
||||
if (current.media_type == MEDIA_TYPE_OSS) {
|
||||
remove(path);
|
||||
}
|
||||
|
||||
|
||||
finish:
|
||||
pg_free(backup_mode);
|
||||
pg_free(start_lsn);
|
||||
pg_free(stop_lsn);
|
||||
pg_free(status);
|
||||
pg_free(parent_backup);
|
||||
pg_free(merge_dest_backup);
|
||||
pg_free(program_version);
|
||||
pg_free(server_version);
|
||||
pg_free(compress_alg);
|
||||
pg_free(recovery_name);
|
||||
pg_free(storage_type);
|
||||
pg_free(oss_status);
|
||||
|
||||
return backup;
|
||||
}
|
||||
|
||||
@ -412,7 +412,13 @@ pgFileFree(void *file)
|
||||
file_ptr = (pgFile *) file;
|
||||
|
||||
pfree(file_ptr->linked);
|
||||
pfree(file_ptr->rel_path);
|
||||
|
||||
if (file_ptr->rel_path != NULL) {
|
||||
pfree(file_ptr->rel_path);
|
||||
|
||||
} else if (file_ptr->name != NULL) {
|
||||
pfree(file_ptr->name);
|
||||
}
|
||||
|
||||
pfree(file);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user