Commit 969274d8 authored by Tatsuo Ishii's avatar Tatsuo Ishii

Fix memory leak.

Memory is allocated twice for "file" and "files" variables in
BufFileOpenShared().

Author: Antonin Houska
Discussion: https://postgr.es/m/11329.1529045692%40localhost
parent 74da7cda
...@@ -277,10 +277,10 @@ BufFileCreateShared(SharedFileSet *fileset, const char *name) ...@@ -277,10 +277,10 @@ BufFileCreateShared(SharedFileSet *fileset, const char *name)
BufFile * BufFile *
BufFileOpenShared(SharedFileSet *fileset, const char *name) BufFileOpenShared(SharedFileSet *fileset, const char *name)
{ {
BufFile *file = (BufFile *) palloc(sizeof(BufFile)); BufFile *file;
char segment_name[MAXPGPATH]; char segment_name[MAXPGPATH];
Size capacity = 16; Size capacity = 16;
File *files = palloc(sizeof(File) * capacity); File *files;
int nfiles = 0; int nfiles = 0;
file = (BufFile *) palloc(sizeof(BufFile)); file = (BufFile *) palloc(sizeof(BufFile));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment