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

lib/vector/Vlib: fix segfault introduced with #5038 #5109

Merged
merged 1 commit into from
Feb 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions lib/vector/Vlib/net_build.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ int Vect_net_ttb_build_graph(struct Map_info *Map, int ltype, int afield,
dglGraph_s *gr;
dglInt32_t opaqueset[16] = {360000, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0};
struct field_info *Fi;
struct field_info *Fi = NULL;
dbDriver *driver = NULL;
dbDriver *ttbdriver = NULL;
dbHandle handle;
dbString stmt;
dbColumn *Column;
dbColumn *Column = NULL;
dbCatValArray fvarr, bvarr;
int fctype = 0, bctype = 0, nrec, nturns;

Expand Down Expand Up @@ -666,8 +666,13 @@ int Vect_net_ttb_build_graph(struct Map_info *Map, int ltype, int afield,
dglInitializeSPCache(gr, &(Map->dgraph.spCache));

G_message(_("Graph was built"));
Vect_destroy_field_info(Fi);
db_free_column(Column);
if (Fi) {
Vect_destroy_field_info(Fi);
}
if (Column) {
db_free_column(Column);
}

return 0;
}

Expand Down Expand Up @@ -709,11 +714,11 @@ int Vect_net_build_graph(struct Map_info *Map, int ltype, int afield,
dglInt32_t dgl_cost;
dglInt32_t opaqueset[16] = {360000, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0};
struct field_info *Fi;
struct field_info *Fi = NULL;
dbDriver *driver = NULL;
dbHandle handle;
dbString stmt;
dbColumn *Column;
dbColumn *Column = NULL;
dbCatValArray fvarr, bvarr;
int fctype = 0, bctype = 0, nrec;

Expand Down Expand Up @@ -1063,8 +1068,12 @@ int Vect_net_build_graph(struct Map_info *Map, int ltype, int afield,
dglInitializeSPCache(gr, &(Map->dgraph.spCache));

G_message(_("Graph was built"));
Vect_destroy_field_info(Fi);
db_free_column(Column);
if (Fi) {
Vect_destroy_field_info(Fi);
}
if (Column) {
db_free_column(Column);
}

return 0;
}
Loading