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

r.in.gdal: Fix Resource Leak Issue in main.c #5301

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ShubhamDesai
Copy link
Contributor

This pull request fixes issue identified by coverity scan (CID : 1248588)
Used G_free() to fix this issue.

@github-actions github-actions bot added raster Related to raster data processing C Related code is in C module labels Mar 4, 2025
@nilason
Copy link
Contributor

nilason commented Mar 4, 2025

Please address CID1415647 and CID1415695 here too.

@ShubhamDesai
Copy link
Contributor Author

Please address CID1415647 and CID1415695 here too.

these are from vector is it okay to combine it with fix of raster in same pull request

@nilason nilason added this to the 8.5.0 milestone Mar 4, 2025
@nilason
Copy link
Contributor

nilason commented Mar 4, 2025

Please address CID1415647 and CID1415695 here too.

these are from vector is it okay to combine it with fix of raster in same pull request

They are from r.in.gdal too, try filter with /raster/r.in.gdal/*.c .

@ShubhamDesai
Copy link
Contributor Author

Please address CID1415647 and CID1415695 here too.

these are from vector is it okay to combine it with fix of raster in same pull request

They are from r.in.gdal too, try filter with /raster/r.in.gdal/*.c .

for now i have added the proj.c from raster
is it ok if i create another pull request for one that comes under vector or do the vector in same file.

Comment on lines +355 to +356
G_free_key_value(loc_proj_units);
G_free_key_value(loc_proj_info);
Copy link
Contributor

Choose a reason for hiding this comment

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

You can move these lines to the previous scope, after line 353. In addition you can move the definition/initialisation of loc_proj_units and loc_proj_info (L14) to the beginning of the else-statement starting at L153.

You can insert here, as in #5303, freeing of proj_units and proj_info after the else-statement (after L354).

@nilason
Copy link
Contributor

nilason commented Mar 6, 2025

Please address CID1415647 and CID1415695 here too.

these are from vector is it okay to combine it with fix of raster in same pull request

They are from r.in.gdal too, try filter with /raster/r.in.gdal/*.c .

for now i have added the proj.c from raster is it ok if i create another pull request for one that comes under vector or do the vector in same file.

It seems that the CIDs is mixed up, because of identical code in r.in.gdal, v.in.gdal, r.external and v.external. The same fix should be applied to all, but in separate PRs. #5303 is a good start.

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 raster Related to raster data processing
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants