Author: matt
Date: 2010-12-31 14:13:07 -0800 (Fri, 31 Dec 2010)
New Revision: 8146
Log:
STR 2501: fixed freeing of incremented pointer.

Modified:
   branches/branch-1.3/src/filename_absolute.cxx

Modified: branches/branch-1.3/src/filename_absolute.cxx
===================================================================
--- branches/branch-1.3/src/filename_absolute.cxx       2010-12-30 21:08:01 UTC 
(rev 8145)
+++ branches/branch-1.3/src/filename_absolute.cxx       2010-12-31 22:13:07 UTC 
(rev 8146)
@@ -163,8 +163,8 @@
   
   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 @@
   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 @@
   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 @@
   // 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 @@
   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 @@
   // 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 @@
   // finally add the differing path from "from"
   strlcat(to, slash, tolen);
 
-  free(cwd);
+  free(cwd_buf);
   return 1;
 }
 

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to