Skip to content

Commit 0a8da8c

Browse files
author
Marco Aurelio da Costa
committed
Fix memory leaks
1 parent a1f17da commit 0a8da8c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/grib_context.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -881,6 +881,7 @@ void grib_context_set_definitions_path(grib_context* c, const char* path)
881881
GRIB_MUTEX_INIT_ONCE(&once, &init);
882882
GRIB_MUTEX_LOCK(&mutex_c);
883883

884+
free(c->grib_definition_files_path);
884885
c->grib_definition_files_path = strdup(path);
885886
grib_context_log(c, GRIB_LOG_DEBUG, "Definitions path changed to: %s", c->grib_definition_files_path);
886887

@@ -893,6 +894,7 @@ void grib_context_set_samples_path(grib_context* c, const char* path)
893894
GRIB_MUTEX_INIT_ONCE(&once, &init);
894895
GRIB_MUTEX_LOCK(&mutex_c);
895896

897+
free(c->grib_samples_path);
896898
c->grib_samples_path = strdup(path);
897899
grib_context_log(c, GRIB_LOG_DEBUG, "Samples path changed to: %s", c->grib_samples_path);
898900

0 commit comments

Comments
 (0)