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

lib/vector/Vlib: Fix Resource Leak issue in break_polygons.c #4612

Merged
merged 2 commits into from
Nov 5, 2024

Conversation

ShubhamDesai
Copy link
Contributor

This pull request fixes issue identified by Coverity scan (CID: 1207832).
Changes Made:

  • Each call to open(filename, O_RDWR | O_CREAT | O_EXCL, 0600) now checks if the file descriptor (fd or xpntfd) was successfully created.
  • If file creation fails, G_fatal_error() is invoked, and the temporary filename is freed before the function exits.
  • If xpntfd creation fails, it also cleans up by destroying the RTree and closing fd.
  • Also there is a check for remove(filename). I have used G_warning over there to print message. Not sure whether to use G_fatal or G_warning.

@github-actions github-actions bot added vector Related to vector data processing C Related code is in C libraries labels Oct 29, 2024
Copy link
Contributor

@nilason nilason left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some suggestions.
And please address CID 1207831 too with this PR.

lib/vector/Vlib/break_polygons.c Outdated Show resolved Hide resolved
lib/vector/Vlib/break_polygons.c Outdated Show resolved Hide resolved
lib/vector/Vlib/break_polygons.c Outdated Show resolved Hide resolved
@nilason nilason added this to the 8.5.0 milestone Oct 29, 2024
@ShubhamDesai
Copy link
Contributor Author

Some suggestions. And please address CID 1207831 too with this PR.

Done

Copy link
Contributor

@nilason nilason left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@nilason nilason merged commit 3307797 into OSGeo:main Nov 5, 2024
26 checks passed
@a0x8o a0x8o mentioned this pull request Nov 6, 2024
a0x8o pushed a commit to a0x8o/grass that referenced this pull request Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C Related code is in C libraries vector Related to vector data processing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants