diff --git a/src/bin/pg_dump/pg_backup_tar.cpp b/src/bin/pg_dump/pg_backup_tar.cpp index 3d09641e1..39f83edc2 100644 --- a/src/bin/pg_dump/pg_backup_tar.cpp +++ b/src/bin/pg_dump/pg_backup_tar.cpp @@ -834,6 +834,10 @@ static void _CloseArchive(ArchiveHandle* AH) RestoreArchive((Archive*)AH); if (AH->ropt != NULL) { + if (AH->ropt->dbname) { + free(AH->ropt->dbname); + AH->ropt->dbname = NULL; + } free(AH->ropt); AH->ropt = NULL; }