Skip to content

Commit

Permalink
Fix memory leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
ReallyNiceGuy committed Nov 16, 2023
1 parent a1f17da commit 0d9a945
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/grib_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,7 @@ void grib_context_set_definitions_path(grib_context* c, const char* path)
GRIB_MUTEX_INIT_ONCE(&once, &init);
GRIB_MUTEX_LOCK(&mutex_c);

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

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

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

Expand Down

0 comments on commit 0d9a945

Please sign in to comment.