From b12154c5d5be2d8c8d8b6e16c4c095104aa54a5c Mon Sep 17 00:00:00 2001 From: Shubham Vasudeo Desai Date: Wed, 22 Jan 2025 17:24:25 -0500 Subject: [PATCH] Fix Resource Leak issue --- lib/ogsf/gp3.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/ogsf/gp3.c b/lib/ogsf/gp3.c index 135d15caa78..2c4dc3a949c 100644 --- a/lib/ogsf/gp3.c +++ b/lib/ogsf/gp3.c @@ -179,6 +179,7 @@ int Gp_load_sites_thematic(geosite *gp, struct Colors *colors) int red, blu, grn; const char *str; const char *mapset; + char *fname; dbDriver *driver; dbValue value; @@ -208,8 +209,9 @@ int Gp_load_sites_thematic(geosite *gp, struct Colors *colors) G_fatal_error(_("Unable to open database <%s> by driver <%s>"), Fi->database, Fi->driver); } - G_message(_("Loading thematic points layer <%s>..."), - G_fully_qualified_name(gp->filename, mapset)); + fname = G_fully_qualified_name(gp->filename, mapset); + G_message(_("Loading thematic points layer <%s>..."), fname); + G_free(fname); npts = nskipped = 0; for (gpt = gp->points; gpt; gpt = gpt->next) { gpt->style = (gvstyle *)G_malloc(sizeof(gvstyle)); @@ -295,5 +297,7 @@ int Gp_load_sites_thematic(geosite *gp, struct Colors *colors) _("%d points without category. " "Unable to determine color rules for features without category."), nskipped); + db_close_database_shutdown_driver(driver); + Vect_destroy_field_info(Fi); return npts; }