Skip to content

d.vect.thematic: Fix Resource Leak issue in plot1.c #5273

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 3 commits into from
Mar 13, 2025

Conversation

ShubhamDesai
Copy link
Contributor

This pull request fixes issue identified by coverity scan (CID : 1207610, 1207611, 1207612, 1207613, 1207614)
Used Vect_destroy_cats_struct(), Vect_destroy_line_struct(), G_free() to fix this issue.

@github-actions github-actions bot added C Related code is in C module display labels Mar 3, 2025
@nilason
Copy link
Contributor

nilason commented Mar 6, 2025

All the variables primary_color, fill_color, line_color, Points and Cats need to be freed before every exit (return) of the function. The while-statement (L153) is an infinite loop, exiting only in three cases in the if-else-statement of L194-211.

So, instead of adding 5x3 lines of repetitive code, let us add a goto label at the end of the function (adding a ret variable) and free them all there.

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

All the variables primary_color, fill_color, line_color, Points and Cats need to be freed before every exit (return) of the function. The while-statement (L153) is an infinite loop, exiting only in three cases in the if-else-statement of L194-211.

So, instead of adding 5x3 lines of repetitive code, let us add a goto label at the end of the function (adding a ret variable) and free them all there.

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 e47ba67 into OSGeo:main Mar 13, 2025
28 of 29 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in GRASS GIS Security Mar 13, 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 display module
Projects
Development

Successfully merging this pull request may close these issues.

2 participants