|
fd = open(core_pattern_path, O_RDONLY | PG_BINARY); |
|
|
|
if (fd < 0) |
|
{ |
|
ereport(LOG, (errcode_for_file_access(), |
|
errmsg("could not open file \"%s\".", core_pattern_path))); |
|
return false; |
|
} |
|
|
|
if (read(fd, (char *) buf, sizeof(buf)) < 0) |
|
{ |
|
ereport(LOG, (errcode_for_file_access(), |
|
errmsg("could not read file \"%s\".", core_pattern_path))); |
|
return false; |
|
} |
When viewing code i found possible handle leak on 932.
If the read function returns -1 on error, then close(fd) is not called before return false, which can cause a file descriptor leak.
PolarDB-for-PostgreSQL/external/polar_worker/polar_worker.c
Lines 919 to 933 in accf02e
When viewing code i found possible handle leak on 932.
If the read function returns -1 on error, then close(fd) is not called before return false, which can cause a file descriptor leak.