Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb5d8a77

Browse files
committed
Do not forget to release base36enc_dup()'s result
1 parentfb4c3ff commitb5d8a77

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

‎src/restore.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ do_restore_or_validate(time_t target_backup_id, pgRecoveryTarget *rt,
219219
}
220220
}
221221
}
222+
pg_free(missing_backup_id);
222223
/* No point in doing futher */
223224
elog(ERROR,"%s of backup %s failed.",action,base36enc(dest_backup->start_time));
224225
}
@@ -255,6 +256,7 @@ do_restore_or_validate(time_t target_backup_id, pgRecoveryTarget *rt,
255256
}
256257
}
257258
}
259+
pg_free(parent_backup_id);
258260
tmp_backup=find_parent_full_backup(dest_backup);
259261

260262
/* sanity */

‎src/validate.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,6 @@ do_validate_all(void)
382382
staticvoid
383383
do_validate_instance(void)
384384
{
385-
char*current_backup_id;
386385
inti;
387386
intj;
388387
parray*backups;
@@ -397,7 +396,6 @@ do_validate_instance(void)
397396
for (i=0;i<parray_num(backups);i++)
398397
{
399398
pgBackup*base_full_backup;
400-
char*parent_backup_id;
401399

402400
current_backup= (pgBackup*)parray_get(backups,i);
403401

@@ -412,6 +410,7 @@ do_validate_instance(void)
412410
/* chain is broken */
413411
if (result==0)
414412
{
413+
char*parent_backup_id;
415414
/* determine missing backup ID */
416415

417416
parent_backup_id=base36enc_dup(tmp_backup->parent_backup);
@@ -430,31 +429,31 @@ do_validate_instance(void)
430429
elog(WARNING,"Backup %s has missing parent %s",
431430
base36enc(current_backup->start_time),parent_backup_id);
432431
}
432+
pg_free(parent_backup_id);
433433
continue;
434434
}
435435
/* chain is whole, but at least one parent is invalid */
436436
elseif (result==1)
437437
{
438-
/* determine corrupt backup ID */
439-
parent_backup_id=base36enc_dup(tmp_backup->start_time);
440-
441438
/* Oldest corrupt backup has a chance for revalidation */
442439
if (current_backup->start_time!=tmp_backup->start_time)
443440
{
441+
char*backup_id=base36enc_dup(tmp_backup->start_time);
444442
/* orphanize current_backup */
445443
if (current_backup->status==BACKUP_STATUS_OK)
446444
{
447445
write_backup_status(current_backup,BACKUP_STATUS_ORPHAN);
448446
elog(WARNING,"Backup %s is orphaned because his parent %s has status: %s",
449-
base36enc(current_backup->start_time),parent_backup_id,
447+
base36enc(current_backup->start_time),backup_id,
450448
status2str(tmp_backup->status));
451449
}
452450
else
453451
{
454452
elog(WARNING,"Backup %s has parent %s with status: %s",
455-
base36enc(current_backup->start_time),parent_backup_id,
453+
base36enc(current_backup->start_time),backup_id,
456454
status2str(tmp_backup->status));
457455
}
456+
pg_free(backup_id);
458457
continue;
459458
}
460459
base_full_backup=find_parent_full_backup(current_backup);
@@ -495,6 +494,7 @@ do_validate_instance(void)
495494
*/
496495
if (current_backup->status!=BACKUP_STATUS_OK)
497496
{
497+
char*current_backup_id;
498498
/* This is ridiculous but legal.
499499
* PAGE_b2 <- OK
500500
* PAGE_a2 <- OK

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp