Skip to content

Commit 1cd6a97

Browse files
committed
Free base36enc's results
1 parent e861c7f commit 1cd6a97

File tree

4 files changed

+18
-10
lines changed

4 files changed

+18
-10
lines changed

delete.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,11 @@ pgBackupDeleteFiles(pgBackup *backup)
263263
if (backup->status == BACKUP_STATUS_DELETED)
264264
return 0;
265265

266+
backup_id = base36enc(backup->start_time);
266267
time2iso(timestamp, lengthof(timestamp), backup->recovery_time);
267268

268-
elog(INFO, "delete: %s %s", base36enc(backup->start_time), timestamp);
269+
elog(INFO, "delete: %s %s", backup_id, timestamp);
270+
free(backup_id);
269271

270272
/*
271273
* Update STATUS to BACKUP_STATUS_DELETING in preparation for the case which

restore.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ do_restore_or_validate(time_t target_backup_id,
159159
{
160160
if (target_backup_id != INVALID_BACKUP_ID)
161161
elog(ERROR, "target backup %s does not satisfy restore options",
162-
base36enc(target_backup_id));
162+
base36enc(target_backup_id));
163163
else
164164
/* Try to find another backup that satisfies target options */
165165
continue;

show.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ do_show(time_t requested_backup_id)
3333
if (backup == NULL)
3434
{
3535
elog(INFO, "Requested backup \"%s\" is not found.",
36+
/* We do not need free base36enc's result, we exit anyway */
3637
base36enc(requested_backup_id));
3738
/* This is not error */
3839
return 0;
@@ -174,6 +175,7 @@ show_backup_list(FILE *out, parray *backup_list)
174175
{
175176
pgBackup *backup = parray_get(backup_list, i);
176177
TimeLineID parent_tli;
178+
char *backup_id;
177179
char timestamp[20] = "----";
178180
char duration[20] = "----";
179181
char data_bytes_str[10] = "----";
@@ -194,9 +196,10 @@ show_backup_list(FILE *out, parray *backup_list)
194196

195197
/* Get parent timeline before printing */
196198
parent_tli = get_parent_tli(backup->tli);
199+
backup_id = base36enc(backup->start_time);
197200

198201
fprintf(out, "%-8s %-19s %s%-9s %2d / %d %5s %6s %2X/%08X %2X/%08X %-8s\n",
199-
base36enc(backup->start_time),
202+
backup_id,
200203
timestamp,
201204
backupModes[backup->backup_mode],
202205
backup->stream ? "+STREAM": "+ARCHIVE",
@@ -209,6 +212,8 @@ show_backup_list(FILE *out, parray *backup_list)
209212
(uint32) (backup->stop_lsn >> 32),
210213
(uint32) backup->stop_lsn,
211214
status2str(backup->status));
215+
216+
free(backup_id);
212217
}
213218
}
214219

validate.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ typedef struct
2929
void
3030
pgBackupValidate(pgBackup *backup)
3131
{
32-
char *backup_id_string;
33-
char base_path[MAXPGPATH];
34-
char path[MAXPGPATH];
35-
parray *files;
36-
bool corrupted = false;
32+
char *backup_id_string;
33+
char base_path[MAXPGPATH];
34+
char path[MAXPGPATH];
35+
parray *files;
36+
bool corrupted = false;
3737
pthread_t validate_threads[num_threads];
3838
validate_files_args *validate_threads_args[num_threads];
39-
int i;
39+
int i;
4040

4141
backup_id_string = base36enc(backup->start_time);
4242

@@ -54,7 +54,7 @@ pgBackupValidate(pgBackup *backup)
5454
/* setup threads */
5555
for (i = 0; i < parray_num(files); i++)
5656
{
57-
pgFile *file = (pgFile *) parray_get(files, i);
57+
pgFile *file = (pgFile *) parray_get(files, i);
5858
__sync_lock_release(&file->lock);
5959
}
6060

@@ -95,6 +95,7 @@ pgBackupValidate(pgBackup *backup)
9595
elog(WARNING, "Backup %s is corrupted", backup_id_string);
9696
else
9797
elog(LOG, "Backup %s is valid", backup_id_string);
98+
free(backup_id_string);
9899
}
99100

100101
/*

0 commit comments

Comments
 (0)