-
-
Notifications
You must be signed in to change notification settings - Fork 362
lib/imagery: Fix Resource Leak Issue in iscatt_core.c #6102
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@@ -102,6 +102,7 @@ int I_create_cat_rast(struct Cell_head *cat_rast_region, const char *cat_rast) | |||
} | |||
|
|||
fclose(f_cat_rast); | |||
G_free(row_data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
row_data
needs to be freed before return on L100 too.
@@ -712,9 +717,12 @@ int I_compute_scatts(struct Cell_head *region, struct scCats *scatt_conds, | |||
for (i_band = 0; i_band < n_bands; i_band++) | |||
bands_ids[i_band] = -1; | |||
|
|||
if (n_bands != scatts->n_bands || n_bands != scatt_conds->n_bands) | |||
if (n_bands != scatts->n_bands || n_bands != scatt_conds->n_bands) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This if statement can be moved to the top of the function, before any mallocs. Then there will be no need for unnecessary mallocs and frees.
This pull request fixes issue identified by Coverity Scan ( CID : 1208098, 1208099, 1208100, 1543965, 1543972, 1543985, 1543987, 1543988, 1543989)