Skip to content

v.info: Fix Resource Leak Issues #5515

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

Merged
merged 10 commits into from
Apr 18, 2025
Merged

v.info: Fix Resource Leak Issues #5515

merged 10 commits into from
Apr 18, 2025

Conversation

ShubhamDesai
Copy link
Contributor

This pull request fixes issue identified by Coverity Scan (CID : 1415719)
Used G_free() to fix this issue.

@github-actions github-actions bot added vector Related to vector data processing C Related code is in C module labels Apr 6, 2025
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@nilason
Copy link
Contributor

nilason commented Apr 7, 2025

Please address all similar issues in v.info (filter with /vector/v.info/*.c ).

@nilason nilason added this to the 8.5.0 milestone Apr 7, 2025
@github-project-automation github-project-automation bot moved this to In Progress in GRASS GIS Security Apr 7, 2025
@ShubhamDesai
Copy link
Contributor Author

Please address all similar issues in v.info (filter with /vector/v.info/*.c ).

Done. Addressed all issues.
CID : 1207862, 1207863, 1207864, 1207865 ,1207866, 1207867, 1207868, 1207869, 1415621, 1415654, 1415719, 1415731, 1415761 ,1415807)

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.

Looks good, just a minor observation.

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.

Great, thanks!

@nilason nilason changed the title v.info: Fix Resource Leak Issue in level1.c v.info: Fix Resource Leak Issues Apr 17, 2025
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.

Now I see what is wrong. Vect_get_proj_name(), only sometimes return an allocated string (in contradiction to its documentation). Sometimes it returns constants. If you skip the freeing of the result here, we're good to go.

(You're more than welcome to fix Vect_get_proj_name to always return an allocated string in another PR.

const char *Vect_get_proj_name(struct Map_info *Map)

)

@ShubhamDesai
Copy link
Contributor Author

Now I see what is wrong. Vect_get_proj_name(), only sometimes return an allocated string (in contradiction to its documentation). Sometimes it returns constants. If you skip the freeing of the result here, we're good to go.

(You're more than welcome to fix Vect_get_proj_name to always return an allocated string in another PR.

const char *Vect_get_proj_name(struct Map_info *Map)

)

I have removed it temporarily. I will create new PR to fix the function Vect_get_proj_name

ShubhamDesai and others added 2 commits April 17, 2025 16:35
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@nilason nilason merged commit b60e164 into OSGeo:main Apr 18, 2025
28 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in GRASS GIS Security Apr 18, 2025
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 module vector Related to vector data processing
Projects
Development

Successfully merging this pull request may close these issues.

2 participants