Skip to content

Commit

Permalink
lib/vector/Vlib: Fix Resource Leak issue in build_nat.c (#4954)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShubhamDesai authored Jan 16, 2025
1 parent 965bff5 commit f5e278f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/vector/Vlib/build_nat.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,10 @@ int Vect_build_nat(struct Map_info *Map, int build)
plus->built = GV_BUILD_AREAS;
}

if (build < GV_BUILD_ATTACH_ISLES)
if (build < GV_BUILD_ATTACH_ISLES) {
Vect_destroy_cats_struct(Cats);
return 1;
}

/* Attach isles to areas */
if (plus->built < GV_BUILD_ATTACH_ISLES) {
Expand All @@ -186,8 +188,10 @@ int Vect_build_nat(struct Map_info *Map, int build)
plus->built = GV_BUILD_ATTACH_ISLES;
}

if (build < GV_BUILD_CENTROIDS)
if (build < GV_BUILD_CENTROIDS) {
Vect_destroy_cats_struct(Cats);
return 1;
}

/* Attach centroids to areas */
if (plus->built < GV_BUILD_CENTROIDS) {
Expand Down

0 comments on commit f5e278f

Please sign in to comment.