From 7c16c02dbb98f6d35bd895b23d2ff71df5109a34 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sat, 31 Oct 2009 09:31:47 +0000 Subject: [PATCH] * sec_helper.cc (security_descriptor::realloc): Call free first if current security desriptor has been allocated by GetSecurityInfo. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/sec_helper.cc | 3 +++ 2 files changed, 8 insertions(+) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 5cf39820d..4922d6120 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2009-10-31 Corinna Vinschen + + * sec_helper.cc (security_descriptor::realloc): Call free first if + current security desriptor has been allocated by GetSecurityInfo. + 2009-10-30 Corinna Vinschen * sec_helper.cc (security_descriptor::free): If sd_size is 0, call diff --git a/winsup/cygwin/sec_helper.cc b/winsup/cygwin/sec_helper.cc index f8e01452f..755cab78f 100644 --- a/winsup/cygwin/sec_helper.cc +++ b/winsup/cygwin/sec_helper.cc @@ -288,6 +288,9 @@ security_descriptor::realloc (size_t nsize) { PSECURITY_DESCRIPTOR tmp; + /* Can't re-use buffer allocated by GetSecurityInfo. */ + if (psd && !sd_size) + free (); if (!(tmp = (PSECURITY_DESCRIPTOR) ::realloc (psd, nsize))) return NULL; sd_size = nsize;