Revision: 78026
http://sourceforge.net/p/brlcad/code/78026
Author: starseeker
Date: 2020-12-19 17:34:51 +0000 (Sat, 19 Dec 2020)
Log Message:
-----------
Do some memory cleanup
Modified Paths:
--------------
brlcad/trunk/src/libtclcad/auto_path.c
Modified: brlcad/trunk/src/libtclcad/auto_path.c
===================================================================
--- brlcad/trunk/src/libtclcad/auto_path.c 2020-12-19 15:35:54 UTC (rev
78025)
+++ brlcad/trunk/src/libtclcad/auto_path.c 2020-12-19 17:34:51 UTC (rev
78026)
@@ -216,13 +216,15 @@
bu_vls_sprintf(&buffer, "tclscripts%clod", BU_DIR_SEPARATOR);
p = bu_strdup(bu_vls_cstr(&buffer));
bu_ptbl_ins(&data_subpaths, (long *)p);
+
+ bu_vls_free(&buffer);
}
// First off, see what's in BU_DIR_LIB.
char libdir[MAXPATHLEN] = {0};
- struct bu_vls lib_path = BU_VLS_INIT_ZERO;
bu_dir(libdir, MAXPATHLEN, BU_DIR_LIB, NULL);
{
+ struct bu_vls lib_path = BU_VLS_INIT_ZERO;
struct bu_ptbl found_subpaths = BU_PTBL_INIT_ZERO;
if (strlen(libdir)) {
// Have a library directory, see what's in it
@@ -241,17 +243,22 @@
// better...
for (size_t i = 0; i < BU_PTBL_LEN(&found_subpaths); i++) {
bu_ptbl_rm(&lib_subpaths, BU_PTBL_GET(&found_subpaths, i));
+ // Since lib_subpaths cleanup won't be seeing this string,
+ // we need to free it now.
+ char *str = (char *)BU_PTBL_GET(&found_subpaths, i);
+ bu_free(str, "subpath string");
}
}
+ bu_vls_free(&lib_path);
bu_ptbl_free(&found_subpaths);
}
// Now that we've looked for the libs, handle the data dirs.
- struct bu_vls data_path = BU_VLS_INIT_ZERO;
char datadir[MAXPATHLEN] = {0};
bu_dir(datadir, MAXPATHLEN, BU_DIR_DATA, NULL);
if (strlen(datadir)) {
// Have a directory, see what's in it
+ struct bu_vls data_path = BU_VLS_INIT_ZERO;
for (size_t i = 0; i < BU_PTBL_LEN(&data_subpaths); i++) {
const char *fname = (const char *)BU_PTBL_GET(&data_subpaths, i);
bu_vls_sprintf(&data_path, "%s%c%s", datadir, BU_DIR_SEPARATOR,
fname);
@@ -263,6 +270,7 @@
bu_log("Warning: data path %s is not present in directory
%s\n", fname, datadir);
}
}
+ bu_vls_free(&data_path);
}
/* Iterate over the paths set and modify the real Tcl auto_path */
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits