From 75555907c560908b7c3e5ccdd6f85b89897657c7 Mon Sep 17 00:00:00 2001 From: "Mark (he/his) C. Miller" Date: Thu, 25 May 2023 12:06:01 -0700 Subject: [PATCH] Merge pull request #306 from LLNL/bug-mcm86-13apr23-free-file-globals Patch from Dave Bremer --- src/silo/silo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/silo/silo.c b/src/silo/silo.c index 07e0029a..d593a469 100644 --- a/src/silo/silo.c +++ b/src/silo/silo.c @@ -4432,6 +4432,7 @@ DBClose(DBfile *dbfile) { int id; int retval; + SILO_Globals_t *tmp_file_scope_globals; API_BEGIN2("DBClose", int, -1, api_dummy) { if (!dbfile) @@ -4449,8 +4450,9 @@ DBClose(DBfile *dbfile) free(dbfile->pub.file_lib_version); db_unregister_file(dbfile); + tmp_file_scope_globals = dbfile->pub.file_scope_globals; retval = (dbfile->pub.close) (dbfile); - free(dbfile->pub.file_scope_globals); + free(tmp_file_scope_globals); API_RETURN(retval); } API_END_NOPOP; /*BEWARE: If API_RETURN above is removed use API_END */