OSDN Git Service

* path.cc (path_conv::set_normalized_path): Use crealloc_abort to avoid a
authorcgf <cgf>
Fri, 9 Apr 2010 16:51:06 +0000 (16:51 +0000)
committercgf <cgf>
Fri, 9 Apr 2010 16:51:06 +0000 (16:51 +0000)
memory leak.
* path.h (path_conv::operator =): Just use cstrdup to allocate normalized_path,
avoiding attempt to free a pointer which is allocated in another pc.

winsup/cygwin/ChangeLog
winsup/cygwin/path.cc
winsup/cygwin/path.h

index 01bf2b2..96035a1 100644 (file)
@@ -1,3 +1,11 @@
+2010-04-09  Christopher Faylor  <me+cygwin@cgf.cx>
+
+       * path.cc (path_conv::set_normalized_path): Use crealloc_abort to avoid
+       a memory leak.
+       * path.h (path_conv::operator =): Just use cstrdup to allocate
+       normalized_path, avoiding attempt to free a pointer which is allocated
+       in another pc.
+
 2010-04-07  Corinna Vinschen  <corinna@vinschen.de>
 
        * include/cygwin/version.h: Bump DLL minor version number to 4.
index dba96a6..9e57a0f 100644 (file)
@@ -377,7 +377,7 @@ path_conv::set_normalized_path (const char *path_copy)
   if (path_copy)
     {
       size_t n = strlen (path_copy) + 1;
-      char *p = (char *) cmalloc_abort (HEAP_STR, n);
+      char *p = (char *) crealloc_abort ((void *) normalized_path, n);
       normalized_path = (const char *) memcpy (p, path_copy, n);
     }
 }
index 2f583e9..855f4a2 100644 (file)
@@ -217,7 +217,7 @@ class path_conv
   {
     memcpy (this, &pc, sizeof pc);
     path = cstrdup (pc.path);
-    set_normalized_path (pc.normalized_path);
+    normalized_path = cstrdup(pc.normalized_path);
     wide_path = NULL;
     return *this;
   }