Skip to content

Commit

Permalink
d.vect: Fix Resource Leak issue in attr.c (OSGeo#4496)
Browse files Browse the repository at this point in the history
* fix Resource Leak issue

* Update display/d.vect/attr.c
  • Loading branch information
ShubhamDesai authored Oct 12, 2024
1 parent 779af80 commit 03675b0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions display/d.vect/attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ int display_attr(struct Map_info *Map, int type, char *attrcol,
db_init_string(&text);

fi = Vect_get_field(Map, lattr->field);
if (fi == NULL)
if (fi == NULL) {
Vect_destroy_line_struct(Points);
Vect_destroy_cats_struct(Cats);
return 1;

}
driver = db_start_driver_open_database(fi->driver, fi->database);
if (driver == NULL)
G_fatal_error(_("Unable to open database <%s> by driver <%s>"),
Expand Down Expand Up @@ -140,6 +142,7 @@ int display_attr(struct Map_info *Map, int type, char *attrcol,
db_close_database_shutdown_driver(driver);
Vect_destroy_line_struct(Points);
Vect_destroy_cats_struct(Cats);
Vect_destroy_field_info(fi);

return 0;
}

0 comments on commit 03675b0

Please sign in to comment.