Revision: 72295 http://sourceforge.net/p/brlcad/code/72295 Author: starseeker Date: 2019-01-31 19:34:03 +0000 (Thu, 31 Jan 2019) Log Message: ----------- Zeroing of apbuf needs to happen whenever bu_free_mapped_files is freeing the mapped file, not just when db_open is working with it.
Modified Paths: -------------- brlcad/trunk/src/libbu/mappedfile.c brlcad/trunk/src/librt/db_open.c Modified: brlcad/trunk/src/libbu/mappedfile.c =================================================================== --- brlcad/trunk/src/libbu/mappedfile.c 2019-01-31 16:06:43 UTC (rev 72294) +++ brlcad/trunk/src/libbu/mappedfile.c 2019-01-31 19:34:03 UTC (rev 72295) @@ -407,12 +407,10 @@ if (UNLIKELY(verbose || (bu_debug&BU_DEBUG_MAPPED_FILE))) bu_pr_mapped_file("freeing", mp); - /* If application pointed mp->apbuf at mp->buf, break that - * association so we don't double-free the buffer. - */ - if (mp->apbuf == mp->buf) - mp->apbuf = (void *)NULL; + mp->apbuf = (void *)NULL; + + #ifdef HAVE_SYS_MMAN_H if (mp->is_mapped) { int ret; Modified: brlcad/trunk/src/librt/db_open.c =================================================================== --- brlcad/trunk/src/librt/db_open.c 2019-01-31 16:06:43 UTC (rev 72294) +++ brlcad/trunk/src/librt/db_open.c 2019-01-31 19:34:03 UTC (rev 72295) @@ -306,13 +306,6 @@ /* free up any mapped files */ if (dbip->dbi_mf) { - - /* Clear dbi_mf->apbuf - db_open is storing the dbip here, and the dbip - * will be cleared by free at the end of db_close. If this file is - * opened again and apbuf isn't NULL, db_open will try to reuse it and - * RT_CK_DBI will fail. */ - dbip->dbi_mf->apbuf = NULL; - bu_close_mapped_file(dbip->dbi_mf); bu_free_mapped_files(0); dbip->dbi_mf = (struct bu_mapped_file *)NULL; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ BRL-CAD Source Commits mailing list brlcad-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/brlcad-commits