[Python-checkins] python/dist/src/Modules _bsddb.c,1.5,1.6

greg@users.sourceforge.net greg@users.sourceforge.net
Fri, 17 Jan 2003 00:42:52 -0800


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv9401/extsrc

Modified Files:
	_bsddb.c 
Log Message:
bugfix: do not double-close DB cursor during deallocation when the
        underlying DB has already been closed (and thus all of its cursors).
        This fixes a potential segfault.
        SF pybsddb bug id 667343
bugfix: close the DB object when raising an exception due to an error
        during DB.open.  This prevents an exception when closing the
        environment about not all databases being closed.
        SF pybsddb bug id 667340


Index: _bsddb.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/_bsddb.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** _bsddb.c	17 Jan 2003 07:56:16 -0000	1.5
--- _bsddb.c	17 Jan 2003 08:42:50 -0000	1.6
***************
*** 747,751 ****
      if (self->dbc != NULL) {
          MYDB_BEGIN_ALLOW_THREADS;
!         err = self->dbc->c_close(self->dbc);
          self->dbc = NULL;
          MYDB_END_ALLOW_THREADS;
--- 747,752 ----
      if (self->dbc != NULL) {
          MYDB_BEGIN_ALLOW_THREADS;
! 	if (self->mydb->db != NULL)
!             err = self->dbc->c_close(self->dbc);
          self->dbc = NULL;
          MYDB_END_ALLOW_THREADS;
***************
*** 1624,1627 ****
--- 1625,1629 ----
      MYDB_END_ALLOW_THREADS;
      if (makeDBError(err)) {
+         self->db->close(self->db, 0);
          self->db = NULL;
          return NULL;