Revision: 42321
http://brlcad.svn.sourceforge.net/brlcad/?rev=42321&view=rev
Author: starseeker
Date: 2011-01-16 17:19:51 +0000 (Sun, 16 Jan 2011)
Log Message:
-----------
Localize the real_path var, free bu_dirname results - still need to see if
bu_argv0_full_path needs memory management help.
Modified Paths:
--------------
brlcad/branches/cmake/src/libbu/brlcad_path.c
Modified: brlcad/branches/cmake/src/libbu/brlcad_path.c
===================================================================
--- brlcad/branches/cmake/src/libbu/brlcad_path.c 2011-01-16 16:44:15 UTC
(rev 42320)
+++ brlcad/branches/cmake/src/libbu/brlcad_path.c 2011-01-16 17:19:51 UTC
(rev 42321)
@@ -392,7 +392,6 @@
{
static char result[MAXPATHLEN] = {0};
const char *lhs;
- char real_path[MAXPATHLEN] = {0};
struct bu_vls searched;
char where[MAX_WHERE_SIZE] = {0};
@@ -437,10 +436,18 @@
#endif
/* run-time path identification */
- realpath(bu_argv0_full_path(), real_path);
- lhs = (const char *)bu_dirname((const char *)bu_dirname(real_path));
+ lhs = bu_argv0_full_path();
if (lhs) {
- if (_bu_find_path(result, lhs, rhs, &searched, where)) {
+ char real_path[MAXPATHLEN] = {0};
+ char *dirpath;
+ realpath(lhs, real_path);
+ dirpath = bu_dirname(real_path);
+ snprintf(real_path, MAXPATHLEN, "%s", dirpath);
+ bu_free(dirpath, "free bu_dirname");
+ dirpath = bu_dirname(real_path);
+ snprintf(real_path, MAXPATHLEN, "%s", dirpath);
+ bu_free(dirpath, "free bu_dirname");
+ if (_bu_find_path(result, real_path, rhs, &searched, where)) {
if (UNLIKELY(bu_debug & BU_DEBUG_PATHS)) {
bu_log("Found: Run-time path identification [%s]\n", result);
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits