mirror of
				https://github.com/postgres/postgres.git
				synced 2025-10-29 22:49:41 +03:00 
			
		
		
		
	Fix memory leaks in pg_combinebackup/reconstruct.c.
One code path forgot to free the separately-malloc'd filename part of a struct rfile. Another place freed the filename but forgot the struct rfile itself. These seem worth fixing because with a large backup we could be dealing with many files. Coverity found the bug in make_rfile(). I found the other one by manual inspection.
This commit is contained in:
		| @@ -370,6 +370,7 @@ reconstruct_from_incremental_file(char *input_filename, | ||||
| 		if (s->relative_block_numbers != NULL) | ||||
| 			pfree(s->relative_block_numbers); | ||||
| 		pg_free(s->filename); | ||||
| 		pg_free(s); | ||||
| 	} | ||||
| 	pfree(sourcemap); | ||||
| 	pfree(offsetmap); | ||||
| @@ -517,6 +518,7 @@ make_rfile(char *filename, bool missing_ok) | ||||
| 	{ | ||||
| 		if (missing_ok && errno == ENOENT) | ||||
| 		{ | ||||
| 			pg_free(rf->filename); | ||||
| 			pg_free(rf); | ||||
| 			return NULL; | ||||
| 		} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user