summaryrefslogtreecommitdiff
path: root/src/filename_absolute.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2010-12-31 22:13:07 +0000
committerMatthias Melcher <fltk@matthiasm.com>2010-12-31 22:13:07 +0000
commit46f9ca2ad9f6ea510e15872d65ba4a01e5acca5b (patch)
tree66fb1007e5cb84fafd2f1453c66e0455b8bb3db6 /src/filename_absolute.cxx
parent181492b446deab22bc5e7e65506241ad6f7ed781 (diff)
STR 2501: fixed freeing of incremented pointer.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8146 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/filename_absolute.cxx')
-rw-r--r--src/filename_absolute.cxx16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/filename_absolute.cxx b/src/filename_absolute.cxx
index a3fea5bbe..f9257f08c 100644
--- a/src/filename_absolute.cxx
+++ b/src/filename_absolute.cxx
@@ -163,8 +163,8 @@ fl_filename_relative(char *to, // O - Relative filename
char *newslash; // Directory separator
const char *slash; // Directory separator
- char *cwd = 0L;
- if (base) cwd = strdup(base);
+ char *cwd = 0L, *cwd_buf = 0L;
+ if (base) cwd = cwd_buf = strdup(base);
// return if "from" is not an absolute path
#if defined(WIN32) || defined(__EMX__)
@@ -175,7 +175,7 @@ fl_filename_relative(char *to, // O - Relative filename
if (from[0] == '\0' || !isdirsep(*from)) {
#endif // WIN32 || __EMX__
strlcpy(to, from, tolen);
- if (cwd) free(cwd);
+ if (cwd_buf) free(cwd_buf);
return 0;
}
@@ -188,7 +188,7 @@ fl_filename_relative(char *to, // O - Relative filename
if (!cwd || cwd[0] == '\0' || !isdirsep(*cwd)) {
#endif // WIN32 || __EMX__
strlcpy(to, from, tolen);
- if (cwd) free(cwd);
+ if (cwd_buf) free(cwd_buf);
return 0;
}
@@ -200,7 +200,7 @@ fl_filename_relative(char *to, // O - Relative filename
// test for the exact same string and return "." if so
if (!strcasecmp(from, cwd)) {
strlcpy(to, ".", tolen);
- free(cwd);
+ free(cwd_buf);
return (1);
}
@@ -208,7 +208,7 @@ fl_filename_relative(char *to, // O - Relative filename
if (tolower(*from & 255) != tolower(*cwd & 255)) {
// Not the same drive...
strlcpy(to, from, tolen);
- free(cwd);
+ free(cwd_buf);
return 0;
}
@@ -218,7 +218,7 @@ fl_filename_relative(char *to, // O - Relative filename
// test for the exact same string and return "." if so
if (!strcmp(from, cwd)) {
strlcpy(to, ".", tolen);
- free(cwd);
+ free(cwd_buf);
return (1);
}
#endif // WIN32 || __EMX__
@@ -262,7 +262,7 @@ fl_filename_relative(char *to, // O - Relative filename
// finally add the differing path from "from"
strlcat(to, slash, tolen);
- free(cwd);
+ free(cwd_buf);
return 1;
}