-
-
Notifications
You must be signed in to change notification settings - Fork 361
lib/vector/Vlib: Fix Resource Leak Issue in dbcolumns.c #5915
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>
if (db_open_database(driver, &handle) != DB_OK) | ||
return (NULL); | ||
if (db_open_database(driver, &handle) != DB_OK) { | ||
goto cleanup; |
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.
Here we only need to shutdown driver
and free fi
(open database just failed!).
@@ -74,8 +78,9 @@ const char *Vect_get_column_names(struct Map_info *Map, int field) | |||
G_free(col_names); | |||
G_debug(3, "%s", list); | |||
|
|||
db_close_database(driver); | |||
db_shutdown_driver(driver); | |||
cleanup: |
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.
cleanup_exit
if (db_open_database(driver, &handle) != DB_OK) | ||
return (NULL); | ||
if (db_open_database(driver, &handle) != DB_OK) { | ||
goto cleanup; |
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.
Here we only need to shutdown driver and free fi (open database just failed!).
@@ -130,8 +139,9 @@ const char *Vect_get_column_types(struct Map_info *Map, int field) | |||
G_free(sqltype_names); | |||
G_debug(3, "%s", list); | |||
|
|||
db_close_database(driver); | |||
db_shutdown_driver(driver); | |||
cleanup: |
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.
See note above.
if (db_open_database(driver, &handle) != DB_OK) | ||
return (NULL); | ||
if (db_open_database(driver, &handle) != DB_OK) { | ||
goto cleanup; |
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.
Same issues for Vect_get_column_names_types
as for the other two function.
This pull request fixes issue identified by coverity scan (CID : 1207742, 1207743, 1207745, 1207746, 1207748, 1207749)
Used
Vect_destroy_field_info( ); db_close_database_shutdown_driver( );
to fix this issue.