New submission from STINNER Victor <[EMAIL PROTECTED]>:

newDBObject(), called by DB_construct(), doesn't check correctly the 
result of all to the external function db_create(). It checks if 
self->db is NULL, but db_create() doesn't change self->db value on 
error. So if self->db is uninitialized, the error is not catched.

Two ideas to fix the bug:
 - check "if (err)" instead of "if (self->db != NULL)"
 - set self->db=NULL before calling db_create()

I implemented the second proposition in the attached patch.

Note: The bug occurs with PYDEBUG, I don't know if PyObject_New() 
fills new allocate memory to zero (I think no, but I'm not sure).

----------
components: Library (Lib)
files: bsddb_create.patch
keywords: patch
messages: 69358
nosy: haypo
severity: normal
status: open
title: invalid check of _bsddb creation failure
versions: Python 2.6
Added file: http://bugs.python.org/file10836/bsddb_create.patch

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3307>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to