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

v.to.3d: Fix Resource Leak Issue in trans2.c #4320

Merged
merged 4 commits into from
Sep 16, 2024
Merged

Conversation

ShubhamDesai
Copy link
Contributor

@ShubhamDesai ShubhamDesai commented Sep 14, 2024

This pull request addresses resource leak issue identified by coverity scan (CID: 1207898)

The function Vect_get_field() assigns a struct field_info object to Fi, which includes several dynamically allocated strings such as name, driver, database, table, and key. However, when Fi goes out of scope at the end of the function, the memory allocated for Fi and its strings isn't properly freed, causing a memory leak. To fix this, used existing function Vect_destroy_field_info(Fi) right after the database operations are completed and before the function exits. This ensures that all allocated memory is released, preventing the leak.

@github-actions github-actions bot added vector Related to vector data processing C Related code is in C module labels Sep 14, 2024
Shubham Vasudeo Desai added 2 commits September 14, 2024 18:06
@echoix echoix merged commit fdcd8d8 into OSGeo:main Sep 16, 2024
26 checks passed
@neteler neteler added this to the 8.5.0 milestone Sep 17, 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 module vector Related to vector data processing
Projects
Development

Successfully merging this pull request may close these issues.

4 participants