@@ -162,7 +162,7 @@ int do_retention(void)
162
162
if (retention_is_set && !backup_list_is_empty )
163
163
do_retention_internal (backup_list ,to_keep_list ,to_purge_list );
164
164
165
- if (merge_expired && !dry_run )
165
+ if (merge_expired && !dry_run && ! backup_list_is_empty )
166
166
do_retention_merge (backup_list ,to_keep_list ,to_purge_list );
167
167
168
168
if (delete_expired && !dry_run && !backup_list_is_empty )
@@ -191,7 +191,7 @@ int do_retention(void)
191
191
}
192
192
193
193
/* Evaluate every backup by retention policies and populate purge and keep lists.
194
- * Also for every backup printproposed action ('Active' or 'Expired') according
194
+ * Also for every backup printits status ('Active' or 'Expired') according
195
195
* to active retention policies.
196
196
*/
197
197
static void
@@ -259,9 +259,8 @@ do_retention_internal(parray *backup_list, parray *to_keep_list, parray *to_purg
259
259
* FULL CORRUPT in retention (not count toward redundancy limit)
260
260
* FULL in retention
261
261
* ------retention redundancy -------
262
- * PAGE4 in retention
263
- * ------retention window -----------
264
262
* PAGE3 in retention
263
+ * ------retention window -----------
265
264
* PAGE2 out of retention
266
265
* PAGE1 out of retention
267
266
* FULL out of retention <- We are here
@@ -362,8 +361,8 @@ do_retention_merge(parray *backup_list, parray *to_keep_list, parray *to_purge_l
362
361
int j ;
363
362
364
363
/* IMPORTANT: we can merge to only those FULL backup, that is NOT
365
- * guarded by retention and finaltargets of suchmerges must be
366
- * incremental backup that is guarded by retention !!!
364
+ * guarded by retention and finaltarget of suchmerge must be
365
+ *an incremental backup that is guarded by retention !!!
367
366
*
368
367
* PAGE4 E
369
368
* PAGE3 D
@@ -420,6 +419,7 @@ do_retention_merge(parray *backup_list, parray *to_keep_list, parray *to_purge_l
420
419
keep_backup_id = base36enc_dup (keep_backup -> start_time );
421
420
elog (INFO ,"Merge incremental chain between FULL backup %s and backup %s" ,
422
421
base36enc (full_backup -> start_time ),keep_backup_id );
422
+ pg_free (keep_backup_id );
423
423
424
424
merge_list = parray_new ();
425
425
@@ -553,8 +553,10 @@ do_retention_purge(parray *to_keep_list, parray *to_purge_list)
553
553
base36enc (delete_backup -> start_time ),keeped_backup_id );
554
554
555
555
purge = false;
556
+ pg_free (keeped_backup_id );
556
557
break ;
557
558
}
559
+ pg_free (keeped_backup_id );
558
560
}
559
561
560
562
/* Retain backup */