GetTokenInformation() and FreeSid() at port/exec.c

From: TAKATSUKA Haruka <harukat(at)sraoss(dot)co(dot)jp>
To: pgsql-bugs(at)postgresql(dot)org
Subject: GetTokenInformation() and FreeSid() at port/exec.c
Date: 2009-06-23 01:36:39
Message-ID: 20090623103639.1eca170c.harukat@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi.

We found the unbalance of xxAlloc and xxFree at AddUserToDacl() in
src/port/exec.c (of current HEAD code).

psidUser is a pointer of the element of a TOKEN_USER structure
allocated by HeapAlloc(). The FreeSid() frees a SID allocated by
AllocateAndInitializeSid(). I think that it is correct to use
HeapFree(GetProcessHeap(), 0, pTokenUser).

At present, a specific error, crash or trouble seems not to have happened.

src/port/exec.c:748 AddUserToDacl()
src/port/exec.c:841 GetUserSid()
pTokenUser = (PTOKEN_USER) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwLength);

src/port/exec.c:807 AddUserToDacl()
FreeSid(psidUser);

______________________________________________________________________
TAKATSUKA Haruka harukat(at)sraoss(dot)co(dot)jp
SRA OSS, Inc http://www.sraoss.co.jp

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrew Chernow 2009-06-23 03:55:36 Re: GetTokenInformation() and FreeSid() at port/exec.c
Previous Message Nick Roosevelt 2009-06-22 22:02:51 BUG #4872: Geometric function problem