diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 01bf2b206..96035a122 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,11 @@ +2010-04-09 Christopher Faylor + + * 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 * include/cygwin/version.h: Bump DLL minor version number to 4. diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index dba96a624..9e57a0f15 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -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); } } diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h index 2f583e9e7..855f4a26d 100644 --- a/winsup/cygwin/path.h +++ b/winsup/cygwin/path.h @@ -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; }