Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverity issue: Leaking file descriptor in main.c #1532

Open
ganeshmurthy opened this issue Jun 24, 2024 · 0 comments
Open

Coverity issue: Leaking file descriptor in main.c #1532

ganeshmurthy opened this issue Jun 24, 2024 · 0 comments
Assignees

Comments

@ganeshmurthy
Copy link
Contributor

ganeshmurthy commented Jun 24, 2024

170            if (fd != 0) fail(pipefd[1], "Can't redirect stdin to /dev/null");
      10. Condition dup(fd) < 0, taking false branch.
      CID 379163:(#1 of 2):Resource leak (RESOURCE_LEAK) [ "select issue" ]
      CID 379174:Argument cannot be negative (NEGATIVE_RETURNS) [ "select issue" ]
171            if (dup(fd) < 0) fail(pipefd[1], "Can't redirect stdout to /dev/null");
      11. open_fn: Returning handle opened by dup.
      12. Condition dup(fd) < 0, taking false branch.
     
CID 379163: (#2 of 2): Resource leak (RESOURCE_LEAK)
13. leaked_handle: Failing to save or close handle opened by dup(fd) leaks it.
172            if (dup(fd) < 0) fail(pipefd[1], "Can't redirect stderr /dev/null");

Also this

      23. Condition pf == NULL, taking true branch.
      24. var_compare_op: Comparing pf to null implies that pf might be null.
      25. Condition *__errno_location(), taking false branch.
228                if (pf == 0) fail(pipefd[1], "Can't write pidfile %s", pidfile);
     
CID 379178: (#1 of 1): Dereference after null check (FORWARD_NULL)
26. var_deref_model: Passing null pointer pf to fprintf, which dereferences it.
229                fprintf(pf, "%d\n", getpid());
230                fclose(pf);
231            }
@ganeshmurthy ganeshmurthy linked a pull request Jun 24, 2024 that will close this issue
@ganeshmurthy ganeshmurthy self-assigned this Jun 24, 2024
@ganeshmurthy ganeshmurthy added this to the 3.0.0 milestone Jun 24, 2024
@ganeshmurthy ganeshmurthy changed the title Leaking file descriptor in main.c Coverity issue: Leaking file descriptor in main.c Jun 24, 2024
@ganeshmurthy ganeshmurthy removed this from the 3.0.0 milestone Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant