Skip to content

Possible handle leak in file polar_worker.c #628

Description

@kuznetsovvvv

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions