From: | Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp> |
---|---|
To: | ah(at)cybertec(dot)at |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Memory leaks in BufFileOpenShared() |
Date: | 2018-06-15 07:20:03 |
Message-ID: | 20180615.162003.2258832502225295119.t-ishii@sraoss.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> Memory is allocated twice for "file" and "files" variables. Possible fix:
>
> diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c
> index d8a18dd3dc..00f61748b3 100644
> --- a/src/backend/storage/file/buffile.c
> +++ b/src/backend/storage/file/buffile.c
> @@ -277,10 +277,10 @@ BufFileCreateShared(SharedFileSet *fileset, const char *name)
> BufFile *
> BufFileOpenShared(SharedFileSet *fileset, const char *name)
> {
> - BufFile *file = (BufFile *) palloc(sizeof(BufFile));
> + BufFile *file;
> char segment_name[MAXPGPATH];
> Size capacity = 16;
> - File *files = palloc(sizeof(File) * capacity);
> + File *files;
> int nfiles = 0;
>
> file = (BufFile *) palloc(sizeof(BufFile));
Good catch. Thanks.
Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp
From | Date | Subject | |
---|---|---|---|
Next Message | Rajkumar Raghuwanshi | 2018-06-15 07:32:51 | Getting "ERROR: did not find all requested child rels in append_rel_list" when enable_partition_pruning is on |
Previous Message | Antonin Houska | 2018-06-15 06:54:52 | Memory leaks in BufFileOpenShared() |