aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/adaint.c
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2009-04-20 12:23:29 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2009-04-20 12:23:29 +0200
commit4fd1e8b0018d82b6830bd57d413e8429b379e580 (patch)
tree574ce9131a64849db6a95cbc24418300aacf56dd /gcc/ada/adaint.c
parent9013065bc05ad988ff59dda83b1847880757f20d (diff)
downloadgcc-4fd1e8b0018d82b6830bd57d413e8429b379e580.zip
gcc-4fd1e8b0018d82b6830bd57d413e8429b379e580.tar.gz
gcc-4fd1e8b0018d82b6830bd57d413e8429b379e580.tar.bz2
[multiple changes]
2009-04-20 Thomas Quinot <quinot@adacore.com> * s-oscons-tmplt.c: Add support for generating a dummy version of s-oscons.ads providing all possible constants. * g-socthi-mingw.ads: Fix calling convention for __gnat_inet_pton. * socket.c (__gnat_inet_pton): On Windows make sure we always use the ANSI version (not the UNICODE version) of WSAStringToAddress. 2009-04-20 Pascal Obry <obry@adacore.com> * adaint.c (__gnat_set_OWNER_ACL): properly free memory allocated for the security descriptor and make sure all handles are closed before leaving this procedure. From-SVN: r146392
Diffstat (limited to 'gcc/ada/adaint.c')
-rw-r--r--gcc/ada/adaint.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 4977297..24719cf 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -1820,8 +1820,8 @@ __gnat_check_OWNER_ACL
PRIVILEGE_SET PrivilegeSet;
DWORD dwPrivSetSize = sizeof (PRIVILEGE_SET);
BOOL fAccessGranted = FALSE;
- HANDLE hToken;
- DWORD nLength;
+ HANDLE hToken = NULL;
+ DWORD nLength = 0;
SECURITY_DESCRIPTOR* pSD = NULL;
GetFileSecurity
@@ -1839,14 +1839,14 @@ __gnat_check_OWNER_ACL
(wname, OWNER_SECURITY_INFORMATION |
GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION,
pSD, nLength, &nLength))
- return 0;
+ goto error;
if (!ImpersonateSelf (SecurityImpersonation))
- return 0;
+ goto error;
if (!OpenThreadToken
(GetCurrentThread(), TOKEN_DUPLICATE | TOKEN_QUERY, FALSE, &hToken))
- return 0;
+ goto error;
/* Undoes the effect of ImpersonateSelf. */
@@ -1867,9 +1867,17 @@ __gnat_check_OWNER_ACL
&dwPrivSetSize, /* size of PrivilegeSet buffer */
&dwAccessAllowed, /* receives mask of allowed access rights */
&fAccessGranted))
- return 0;
+ goto error;
+ CloseHandle (hToken);
+ HeapFree (GetProcessHeap (), 0, pSD);
return fAccessGranted;
+
+ error:
+ if (hToken)
+ CloseHandle (hToken);
+ HeapFree (GetProcessHeap (), 0, pSD);
+ return 0;
}
static void