[ python-Bugs-1626801 ] posixmodule.c leaks crypto context on Windows

SourceForge.net noreply at sourceforge.net
Thu Jan 4 22:46:13 CET 2007


Bugs item #1626801, was opened at 2007-01-03 12:47
Message generated for change (Comment added) made by ygale
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1626801&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Extension Modules
Group: Python 2.6
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Yitz Gale (ygale)
Assigned to: Martin v. Löwis (loewis)
Summary: posixmodule.c leaks crypto context on Windows

Initial Comment:
The Win API docs for CryptAcquireContext require that
the context be released after use by calling
CryptReleaseContext, but posixmodule.c fails to do so
in win32_urandom().


----------------------------------------------------------------------

>Comment By: Yitz Gale (ygale)
Date: 2007-01-04 23:46

Message:
Logged In: YES 
user_id=1033539
Originator: YES

How do you know that "it is automatically released
by the operating system?"

The documentation for CryptAcquireContext states:
"When you have finished using the CSP, release the
handle by calling the CryptReleaseContext function."

In the example code provided, the wording in the comments
is even stronger:
"When the handle is no longer needed, it must be released."
The example code then explicitly calls CryptReleaseContext.

Do you know absolutely for certain that we are not
leaking resourses if we violate this clear API
requirement?

Reference:
http://msdn2.microsoft.com/en-us/library/aa379886.aspx

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2007-01-04 23:13

Message:
Logged In: YES 
user_id=21627
Originator: NO

I fail to see the problem. Only a single crypto context is allocated, and
it is used all the time, i.e. until the Python interpreter finishes, at
which time it is automatically released by the operating system.

----------------------------------------------------------------------

Comment By: Yitz Gale (ygale)
Date: 2007-01-03 14:12

Message:
Logged In: YES 
user_id=1033539
Originator: YES

You might consider backporting this to 2.5 and 2.4.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1626801&group_id=5470


More information about the Python-bugs-list mailing list